How to blinking effect on the one button, when clicked on other buttons....?

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...!

Answers


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.


Need Your Help

Powershell to set GPO

powershell active-directory powershell-v2.0 gpo

I want to set the value of "Inclusion list for Moderate risk file Types" to enable and add a file extension to the list. The key exists in :

Aggregate specific number of rows

mysql sql

I have a database with many rows and I would like to consecutively aggregate say 10 rows and calculate the average of one column. So row 1 to 10 will be average value no. one, row 11 to 20 will be