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. Bluetooth SyncML Server

Hi all

I am trying to implement Bluetooth SyncML server in Android. But we are
facing few problems.
SDP record registration and connection establishment is successfully done.
Now we get wbml data from Client in form of Obex PUT request.

My problem is I'm not able to cleary define Obex-SynML binding.

1.What should be my response for PUT request of Client. When decoded the
wbxml, it sends Dev Inf and Met Inf data and other Dev CAP(capability) data.
   Should I send Obex -  http ok or Send my Device Capabilities info to
client as response to this PUT request?
2.I had sent my Dev Cap info for that PUT request and got GET request with
empty body.What does this mean??
3.I also changed my response and instead of sending Dev CAP , i just send
Obex - Http ok as response to that PUT request. Again I Got GET request with
empty body. What does this mean??

So I now assume that my Dev CAP info should be sent after we get GET
request. Hence for Client's PUT request I just sent Obex http ok response
and once I get GET request , I send my DevCAP data.
But when I do this I got Disconnect request.

I am not able to understand SyncML- Obex Binding here especially for
different types of sync like Two way Slow sync, One way from client to
server etc.
All I want to do is One way Sync from Client to Server.

The Client that I'm trying to work with is Nokia N8

Any help is highly appreciated.

Thanks & Regards,
Ajith

-- 

2. Getting video frames from Android

Hi Guys,

Is there a way I can get each decoded video frame from Android if I
start playing a video file through media player class?

private MediaPlayer vPlayer = new MediaPlayer();

vPlayer.reset();
vPlayer.setDataSource(locationOfVideoFile);
vPlayer.prepare();
vPlayer.start();

After going through the above code I can hear the audio of the video
that is being played, I understand that it can be done in other ways
but I don't want to open a new window for the video playback. What I
want to do here is to get each decoded frame of the video from Android
somehow :)

-- 

3. Gallery.apk tidak baca data

4. Difference between SQLite on HTC Hero (1.5) and Nexus One (FR72)?

5. Virus Malware di Android Smartphone

6. Kok Android semakin tidak eksklusif ya?

7. Foreign currencies now showing.