Help with a click effect for my own custom button.

by Bure » Tue, 15 Jun 2010 15:49:00 GMT


Sponsored Links
 Hi all.
Have a problem when i try to invoke a click effect for my custom
button. Basically I want my "button" to change background color for
like 100 ms and then change back to the original color. I'm using a
OnClickListener for this, with an additional thread for the sleep
effect.

The problem is that the "button" just updates the second color
(original color) and not the "click" color. I'm new to this so pls
take it easy on me :)

public class NoteButtonListener implements OnClickListener {
         public void onClick(final View v) {
                if(v instanceof NoteButton){
                                Thread t = new Thread(){
                                        public void run(){
                                                try {
                                                        
v.setBackgroundColor(Color.GREEN); //Never shown?
                                                        v.invalidate();
                                                        sleep(100);
                                                        
v.setBackgroundColor(Color.BLUE);
                                                        v.invalidate();
                                                } catch (InterruptedException 
e) {
                                                        e.printStackTrace();
                                                }

                                        }

                                };
                                t.run();
                }
                else if(v instanceof Button){
                }
         }
}

--



Other Threads

1. VideoPlayer Fast Forward/Rewind

Hello all,
I am developing a VideoPlayer based on MediaPlayer provided by
Android.
In this video player, I have to implement Fast Forward(FF) and Fast
Rewind(FR) too apart from other basic play/pause/seek functionality.
I could not find any Direct(fastForward(speed)/fastRewind(speed)) or
Indirect(changeFrameRate(speed)) API in Android to implement the same.
for the time I have implemented the same by using seekTo, but
obviously the performance is not as expected. As to implement FF/FR
one has to change the frame rate.

Does android really not support Fast Forward/Rewind or there is any
workaround to achieve the same?

Please help.

Thanks in Advance.

--~--~---------~--~----~------------~-------~--~----~

2. Android Music Player

Very nice idea :)







-- 
Ran Trifon

--~--~---------~--~----~------------~-------~--~----~

3. Paid Android App Store should have this feature. Hate this about Apple's app Store

4. problem about linux (ubuntu) develop android with Eclispe

5. Use dynamic string instead of Integer in findViewById

6. How to transfer Image bytes from MediaStore.Image ContentProvider to byte [] array

7. Android compatibility on Symbian 60 ?