Android, trying to figure out how animate a bitmap, have timer working, but don't know how to update screen
<p>I got some sample code from her to update text control of a timer.  Next I created a custom View and override the onDraw so I could have animation for the View.  The custom view has a bitmap that for now just move it down one pixel every time the timer goes off then get more fancy after that is working.</p>

<p>I was thinking about calling my custom views invalidate from the timer call, so my OnDraw function will be called.  But then I would not know if its coming from the timer, meaning I will have to move the bitmap, or just from android updating the screen.</p>

<p>What is the best way to do this???
Code with timer</p>

<pre><code>package besttecksolutions.tellafortune;

/////////////
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Handler.Callback;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class cShuffle2  extends Activity   {
    TextView text3;
    long starttime = 0;
    //this  posts a message to the main thread from our timertask
    //and updates the textfield

   //runs without timer be reposting self
   Handler h2 = new Handler();
   Runnable run = new Runnable() {

        @Override
        public void run() {
           long millis = System.currentTimeMillis() - starttime;
           int seconds = (int) (millis / 1000);
           int minutes = seconds / 60;
           seconds     = seconds % 60;

           text3.setText(String.format("%d:%02d", minutes, seconds));

           h2.postDelayed(this, 500);
        }
    };

      @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shuffle2);

        text3 = (TextView)findViewById(R.id.text3);



        h2.postDelayed(run, 0);

        LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout);


        // Add the adView to it
        cShuffleView2 myView;
        myView=new cShuffleView2(this);
            layout.addView(myView);

    }

}
</code></pre>

<p>custom view class that does the animation</p>

<pre><code>package besttecksolutions.tellafortune;



import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.InputStream;
import java.io.IOException;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.content.Intent;
import android.content.Context;

import android.os.Bundle;
import android.view.View;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.os.Bundle;
import android.view.*;
import android.view.View.OnClickListener;

public class cShuffleView2 extends View {

 View t;
 Bitmap icon;

 cShuffleView2( Context context)
    {
        super(context);


        // load in bitmaps
        try {
        AssetManager assetManager= context.getAssets();
       InputStream inputStream;
       inputStream=assetManager.open("bio.png");  
       icon=BitmapFactory.decodeStream(inputStream);
       inputStream.close();
        } catch( IOException e)
        {

        }

    }

 protected void onDraw( Canvas canvas)
    {
    Paint color = new Paint();
    color.setColor(0xffffff00);
    canvas.drawRect(0,0, getWidth(),getHeight(),color);
    canvas.drawBitmap(icon, 100,100,null);

    }
}
</code></pre>
