I have some buttons one is main, others are child, I want blinking effect on main button when I touch child buttons.
I have used onTouchListener on all child buttons, in those listeners, I am calling a method which i used to blink the main button.
method.
public void refreshMainButton() {
Bitmap b1 = Bitmap.createBitmap(BitmapFactory.decodeResource(
getResources(), R.drawable.tabouterover_one));
Bitmap b2 = Bitmap.createBitmap(BitmapFactory.decodeResource(
getResources(), R.drawable.tabouterover_two));
Bitmap b3 = Bitmap.createBitmap(BitmapFactory.decodeResource(
getResources(), R.drawable.tabouterover_three));
Bitmap b = Bitmap.createBitmap(BitmapFactory.decodeResource(
getResources(), R.drawable.tabmain_two));
BitmapDrawable d1 = new BitmapDrawable(b1);
outerImageViews[1].setBackgroundDrawable(d1);
BitmapDrawable d2 = new BitmapDrawable(b2);
outerImageViews[1].setBackgroundDrawable(d2);
BitmapDrawable d3 = new BitmapDrawable(b3);
outerImageViews[1].setBackgroundDrawable(d3);
try {
wait(1000);
} catch (Exception e) {
}
BitmapDrawable d4 = new BitmapDrawable(b);
outerImageViews[1].setBackgroundDrawable(d4);
}
This is showing no effect on main button.
If any one has any idea, please help me.
Thanks in advance…!
I would recommend to use animations to archive this effect.
Android has very harsh limits in the Activity – if the Activity does not respond within a certain time (I guess it was 5 seconds) the application shows a dialog to end it. Into this trap you will run (perhaps) with the wait construct.
Now you might think of laying this out into a thread. But this won’t work, because the UI can only be manipulated from inside the activity.
So just create an animation and start it. Android will do the reset 🙂
I hope I could help.