List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development
Showing posts with label Image Animation. Show all posts
Showing posts with label Image Animation. Show all posts

Wednesday, April 17, 2013

Image Animation in Blackberry (using a series of images)

final Bitmap image000 = Bitmap.getBitmapResource("1.png");
final Bitmap image001 = Bitmap.getBitmapResource("2.png");
final Bitmap image002 = Bitmap.getBitmapResource("3.png");
final Bitmap image003 = Bitmap.getBitmapResource("4.png");
final Bitmap image004 =Bitmap.getBitmapResource("5.png");
final Bitmap image005 = Bitmap.getBitmapResource("6.png");
final Bitmap image006 = Bitmap.getBitmapResource("7.png");
final Bitmap image007 = Bitmap.getBitmapResource("8.png");
final Bitmap image008 = Bitmap.getBitmapResource("9.png");
final Bitmap image009 =Bitmap.getBitmapResource("10.png");
final Bitmap image010 = Bitmap.getBitmapResource("11.png");
final Bitmap image011 =Bitmap.getBitmapResource("12.png");
final BitmapField animationField = new BitmapField(image000);
int counter=0;
Timer animationTimer = new Timer();
TimerTask animationTask;

animationTask = new TimerTask() {

public void run() { if(counter == 0){

animationField.setBitmap(image000); }

if(counter == 1){ animationField.setBitmap(image001); }
if(counter == 2){ animationField.setBitmap(image002); }
if(counter == 3){ animationField.setBitmap(image003); }
if(counter == 4){ animationField.setBitmap(image004); }
if(counter == 5){ animationField.setBitmap(image005); }
if(counter == 6){ animationField.setBitmap(image006); }
if(counter == 7){ animationField.setBitmap(image007); }
if(counter == 8){ animationField.setBitmap(image008); }
if(counter == 9){ animationField.setBitmap(image009); }
if(counter == 10){ animationField.setBitmap(image010); }
if(counter == 11){ animationField.setBitmap(image011);
counter = -1; } counter++;

 } };

animationTimer.scheduleAtFixedRate(animationTask, 0, 100);
add(animationField);