title: How To change the imageview of an appwidget (remoteview) multiple times with a short break between?
body: <p>I am new to Android Development and im stuck with a Problem.
  I hope you guys can help me ;)
  Im am working on an Appwidget, a remoteview with a linearlayout
  that is containing multiple imageviews.
  I worked myself through some tutorials and examples and
  i was able to build up a first app , that detects a clicked imageview to open a specific installed app, or to change the imageresource of some Imageviews.</p>
  
  <p>Now my Problem is that i want to animate the images when the button is clicked.
  I made a drawableAnimation, but then i read that remoteviews dont support these.</p>
  
  <p>So my Idea was to change the pictures manually with a little break between
  For Example:</p>
  
  <p>change imageview </p>
  
  <p>0.1 seconds wait</p>
  
  <p>change imageview </p>
  
  <p>0.1 seconds wait</p>
  
  <p>change imageview </p>
  
  <p>0.1 seconds wait</p>
  
  <p>change imageview </p>
  
  <p>So now i read some about  Sleep(), handlers, and adapterviewflipper (none of it i was able to implement) and i  really dont know which way to go.</p>
  
  <p>Here is the code of my Appwidgetprovider </p>
  
  <pre><code>public class MyWidgetProvider extends AppWidgetProvider {
  
  @Override
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
          int[] appWidgetIds) {
  
      RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_demo);
  
      // Button To Change Imageview
      remoteViews.setOnClickPendingIntent(R.id.B1, buildButtonPendingIntent(context));
      //Buttons to open some installed apps
      remoteViews.setOnClickPendingIntent(R.id.T1, getPendingIntent(context, 1));
      remoteViews.setOnClickPendingIntent(R.id.T2, getPendingIntent(context, 2));
  
      pushWidgetUpdate(context, remoteViews);
  }
  
  
  
  
  public static PendingIntent buildButtonPendingIntent(Context context) {
      Intent intent = new Intent();
      intent.setAction("com.appwidgettest.intent.action.UPDATEUI");
      return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
  }
  
  
  public static PendingIntent getPendingIntent(Context context, int btnId) {
  
  // starts a htc radio app as standart and if button 2 is clicked it starts
  // chrome browser just did this for testing the packagemanager
      PackageManager pm = context.getPackageManager();
      String gg = "com.htc.fm";
      if (btnId==2){gg = "com.android.chrome";
      }
  
      Intent intentt= pm.getLaunchIntentForPackage(gg);
      PendingIntent pi = PendingIntent.getActivity(context, 0, intentt, 0);
  
      return pi;
  }
  
  
  
  public static void pushWidgetUpdate(Context context, RemoteViews remoteViews) {
      ComponentName myWidget = new ComponentName(context, MyWidgetProvider.class);
      AppWidgetManager manager = AppWidgetManager.getInstance(context);
      manager.updateAppWidget(myWidget, remoteViews);     
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and the Broadcastreciever which is working so far.</p>
  
  <pre><code>public class MyWidgetIntentReceiver extends BroadcastReceiver {
  
  
  
  
  @Override
  public void onReceive(Context context, Intent intent) {
      if(intent.getAction().equals("com.appwidgettest.intent.action.UPDATEUI")){
          updateWidgetPictureAndButtonListener(context);
      }
  }
  
  private void updateWidgetPictureAndButtonListener(Context context) {
      final RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_demo);
  
  
      // Here i Change The Imageviews!
      remoteViews.setImageViewResource(R.id.M3, R.drawable.image1);
      //here i need a short time sleep of 0.2 seconds for example
      remoteViews.setImageViewResource(R.id.M2, R.drawable.image2);
      //here too
      remoteViews.setImageViewResource(R.id.M1, R.drawable.image3);
  
  
  
  
  
      // Here to set the Button Listeners
      remoteViews.setOnClickPendingIntent(R.id.B1, MyWidgetProvider.buildButtonPendingIntent(context));
      remoteViews.setOnClickPendingIntent(R.id.T2, MyWidgetProvider.getPendingIntent(context,2));
      remoteViews.setOnClickPendingIntent(R.id.T1, MyWidgetProvider.getPendingIntent(context,1));
  
  
      MyWidgetProvider.pushWidgetUpdate(context.getApplicationContext(), remoteViews);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am really sorry for my bad english^^and i hope you could understand most of it :P</p>
  
  <p>And if you have a better idea for the Title Please tell me </p>
  
  <p>Help me Please!!</p>
  
  <p>Regards T.R.Salvatore</p>