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. Recognize clicks on screen in background service

Hi: I have a background service and want to listen to clicks on the
screen by the user. Is there any standard procedure or experience in
doing this?

-Jens

-- 

2. Google Maps and KMZ Files...Please help

Hey everyone,

I am currently wanting to display radar loops from the NOAA in my app
as an overlay... On my computer I have been able to get them to work
using google earth. Is there a way to replicate this with android
using google maps or earth.

Thanks for your time and help,

Tommy

-- 

3. Android Market - the next logical step

4. OpenGL draws nothing when projection matrix is set to identity

5. Garbage activity tracking

6. Saving Pictures from /drawable in a app to SD Card

7. Unmarshal Parcleable in Broadcast Reviever