I am new in developing apps for android and I need some help.
I need to animating images in footer from specific path folder in SDCARD for all activity, i use footer layout as common for all layout.
I have writen code for animating images by writing below code:
public void AnimateActionHandler() {
try {
Toast.makeText(this, "My Service AnimateActionHandler", Toast.LENGTH_LONG).show();
final Handler mHandler = new Handler();
final Runnable mUpdateResults = new Runnable() {
public void run() {
AnimateandSlideShow();
}
};
int delay = 500; // delay for 1 sec.
int period = 1000; // repeat every 2 sec.
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
mHandler.post(mUpdateResults);
}
}, delay, period);
} catch (Exception e) {
// TODO: handle exception
}
}
public void AnimateandSlideShow() {
try {
Toast.makeText(this, "My Service AnimateandSlideShow", Toast.LENGTH_LONG).show();
if (Config.ImageFilelist.isEmpty()) {
Config.ImageFilelist = GetFileList(AddsPath);
}
if (Config.ImageFilelist.size() <= Config.currentimageindex) {
Config.currentimageindex = 0;
}
Toast.makeText(this, "ImageFilelist::"+Config.ImageFilelist.size(), Toast.LENGTH_LONG).show();
Log.d(TAG, "Config.currentimageindex::"+Config.currentimageindex);
Config.FooterBitmap = BitmapFactory.decodeFile(Config.ImageFilelist.get(Config.currentimageindex).toString());
Log.d(TAG, "Addbmp"+Config.FooterBitmap.getHeight());
Config.slidingimage = (ImageView) findViewById(R.id.goeasy_footer);
Config.slidingimage.setImageBitmap(Config.FooterBitmap);
Log.d(TAG, "JOSEafter");
Animation rotateimage = AnimationUtils.loadAnimation(this,R.anim.splash_anim);
Config.slidingimage.startAnimation(rotateimage);
Config.currentimageindex = Config.currentimageindex + 1;
if (Config.ImageFilelist.size() <= Config.currentimageindex) {
Config.currentimageindex = 0;
}
} catch (Exception e) {
Log.e(TAG, "Set image EXC"+e.toString());
e.printStackTrace();
// TODO: handle exception
}
catch (OutOfMemoryError oe) {
try{
}
catch (Exception e) {
// TODO: handle exception
}
// TODO: handle exception
}
}
Now i would like to play this animation in footer for all screens by service, How can i fix this one, Anyone can help me.