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. Starting specific SystemSettings-Subcategories does not work.

Hey guys,

why does the following work:

startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));

but not this:
startActivity(new Intent(Settings.ACTION_DISPLAY_SETTINGS));

LogCat says No Activity found to handle this Intent. So my question is
how to bring up i.e. the "Sound & Display"-Settings-Activity.

Thx in advance.

Regards,
plusminus
--~--~---------~--~----~------------~-------~--~----~

2. Application install unsuccessful after signing

I can not install my application after signing my application when I
try to download from my server. I keep getting the error "Application
install unsuccessful after signing" when I try to install it. It was
working before I signed it. I am not sure what I am doing wrong. I
have added the MIME type to the server as well.

I made my key using
C:\Program Files\Java\jdk1.6.0_10\bin>keytool -genkey -alias
myapp.keystore -keyalg RSA -validity 20000 -keystore keys/
myapp.keystore

I signed my application by using
C:\Program Files\Java\jdk1.6.0_10\bin>jarsigner -verbose -keystore
keys/myapp.keystore MyApp.apk myapp.keystore

I have double checked with the following
C:\Program Files\Java\jdk1.6.0_10\bin>jarsigner -verify myapp.apk
jar verified.

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

3. com.android.email - Should I stay or should I fork now?

4. Runtime exception with JSONObject.put() ???

5. Project looking for Android Developer/s

6. command line window in emulator

7. problem when adding Layout on MapView