How to change image on focus and unfocus

by Raj » Mon, 23 Jun 2008 16:47:55 GMT

Sponsored Links
 How to chanage the image on focus and unfocus

How to change image on focus and unfocus

by Josh Guilfoyle » Wed, 25 Jun 2008 02:57:16 GMT

 Use a selector drawable as such:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="" ;>
        android:state_focused="true" />
        android:drawable="@drawable/foo_not_focused" />

Then simply use the foo drawable as your image or widget background.


Sponsored Links

Other Threads

1. download a apk file from the server

Yes, it's possible. You have to add the application/
archive mime type on the server side. There's been a few discussions
about this topic in this forum. Search for "MIME" to dig out old


2. Persistent service question


I have a remote service started with startService() from a
BroadcastReceiver that catches BOOTUP_COMPLETED, at phone power up. I
also have a service controller with startService() and stopService()
that works perfectly when no client is bound to the service.

When I bind to my service from clients, stopService doesn't work until
the last client has executed unbindService. And if one of my clients
gets destroyed (just by pushing the Back button on the right side of
the phone) then I can't stop the service at all (it didn't execute

One of the solutions is to execute unbindService in my client at the
onPause event. What is an alternative? Say if I wouldn't have control/
access to the client application and I don't know if the client
executes unbindService at onPause(),  and I still wanted a way to stop
the service at my discretion..what should I do ?

One more thing..for the client's connection to the service I provide
an object (let's say GenericConnection object) that manages the
connection (it provides functions like connectService() and
disconnectService() after being created). That's the only control I
have in the client's code: it instantiates my object and uses its
functions. How can I model my object so that the client would execute
unbindService when its Activity is being stopped? I also thought about
forcing the client, instead of instantiating my object, to extend my
class instead of Activity, and in my class I would override onPause
and call unbindService myself.

 Any other ideas?

3. list chaos

4. Why The sdk create myself diffent donload from release

5. Swipe "tab" view

6. How to display a group of pictures?

7. Wi-Fi ad-hoc support in Android