how to implement tween animation with AppWidget using RemoteViews?

by shleeforandroid » Thu, 30 Apr 2009 17:17:52 GMT


Sponsored Links
 i, guys

I'm testing AppWidget to play animation on the homescreen.

This is my testing source using Service and RemoteViews.

I confirmed the modification of the image of layout's ImageView.

I thought it possible to implement the animation using RemoteViews or
AppWidgetHostView ...
But I failed. I didn't see any change of the image.

How to adapt the animation to RemoteViews?

I tried like this.

Some Imports
import android.appwidget.AppWidgetHostView;
...

public class TestAnimationWidget extends AppWidgetProvider {

@Override
public void onReceive(Context context, Intent intent) {

// TODO Auto-generated method stub
String action = intent.getAction();
if(AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action)){
Bundle extras = intent.getExtras();
if (extras != null) {
int[] appWidgetIds = extras.getIntArray
(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (appWidgetIds != null && appWidgetIds.length > 0) {
this.onUpdate(context, AppWidgetManager.getInstance(context),
appWidgetIds);
}
}
}
else if(AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)){
Bundle extras = intent.getExtras();
if (extras != null) {
int[] appWidgetIds = extras.getIntArray
(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (appWidgetIds != null && appWidgetIds.length > 0) {
this.onDeleted(context, appWidgetIds);
}
}
}
else if(AppWidgetManager.ACTION_APPWIDGET_DISABLED.equals(action)){
this.onDisabled(context);
}
else if(AppWidgetManager.ACTION_APPWIDGET_ENABLED.equals(action)){
this.onEnabled(context);
}
}

@Override
public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[ ] appWidgetIds) {
// TODO Auto-generated method stub
context.startService(new Intent
(context,UpdateServiceAnimation.class));
super.onUpdate(context, appWidgetManager, appWidgetIds);
}

public static class UpdateServiceAnimation extends Service {
private SensingMovement mSensingMove;
private AppWidgetManager mAppWidgetManager;
public AppWidgetProviderInfo mAWPInfo;
private AppWidgetHost mAppWidgetHost;
private List<AppWidgetHostView> mAppWidgetHostViewList;
public static int HOSTID = 0;
static public int count = 0;

int[] mAnim_img_IDs = new int[]{
R.drawable.gallery_photo_1, R.drawable.gallery_photo_2,
R.drawable.gallery_photo_3, R.drawable.gallery_photo_4
};

@Override
public void onCreate() {
mSensingMove = new SensingMovement(this);
mAppWidgetHost = new AppWidgetHost(this,HOSTID);
mAppWidgetManager = AppWidgetManager.getInstance(this);
mAppWidgetHostViewList = new ArrayList<AppWidgetHostView>();
int[ ] appWidgetIds = mAppWidgetManager.getAppWidgetIds(new
ComponentName(this,TestAnimationWidget.class));

for(int i = 0 ; i < appWidgetIds.length ; i++){
mAWPInfo =
mAppWidgetManager.getAppWidgetInfo(appWidgetIds[i]);
mAppWidgetHostViewList.add(i,
mAppWidgetHost.createView(this,
appWidgetIds[i], mAWPInfo));
}

// TODO Auto-generated method stub



Other Threads

1. How to use Google Places API

I found the following note in The Google Places API (Developer
Preview)

http://code.google.com/apis/maps/documentation/places/#PlaceDetailsRequests


Note: To use the Google Places API you must first request a Maps API
client ID and cryptographic key which you must use to sign your
request URLs. For information on signing URL requests, please see the
URL Authentication documentation within the Web Service APIs home
page.


But followed the instruction, I still do not know how to get the Maps
API client ID and cryptographic key.

Could someone help?  Thanks

-- 

2. pagging galaxy tab user,

permisi teman2.. saya mau tanya, saya ada galaxy tab firmware P1000DXJJ1
saya mau install office supaya bisa create file.. uda donlod versi Pro nya,
uda sukses install.. tp pada saat saya ngetik, huruf ga muncul huruf apa2 di
layarnya.. mungkin ada yg bersedia share file apk nya supaya bisa berjalan
dengan sebagaimana mestinya :D

-- 
Best Regards
Adrie


-- Sent From My AndroidPhone With Sense UI --

-- 
===============
"

3. froyp galaxy 5

4. Tulung tulung..para suhu miley.

5. n1 gak bisa boot after upgrade

6. Re[2]: Ask : How to use Tilt&Shift-mode 360

7. 3 buat Internet-an