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. Application fails "unexpectedly" with no errors apparent.

Look at the logcat info (without actually being in the de{*filter*} so you get
the crash).  That should give you the information you need

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------





> 

2. Error: Installing Android

Hi All,

I am using Windows XP professional version 2002 service pack 2.

I download Android SDK for windows and extracted in to directory (i.e
android-sdk-windows)

I ran "android.bat update sdk" from the shell prompt (cmd.exe)

I am getting the following error, can anyone help me on the below error.


-----------------------------------------------------------------------------------------------------------------------------------
Failed to fetch URL
https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS
SSL error. You might want to force download through HTTP in the settings.
-----------------------------------------------------------------------------------------------------------------------------------

Thanks & Regards
Deenadayalan

-- 

3. onTouch() not working properly, HTC Magic

4. getting my current location

5. How long is loooooonnnnggggggg

6. need complied binary of android with bluez

7. How to add new MIME type?