Focus problem with dpad

by tikky » Wed, 09 Dec 2009 01:08:08 GMT

Sponsored Links
I have a a simple activity with  a list view. Each element of the list
view contains a photo, text view and a button. I have an
onClickListener() implemented for the button.
When I touch the button, onClickListener gets called, which is what I
want. But when I use the D-PAD, and press down key, the entire list
item gets focus, so the center-select key takes no effect. I need the
focus to go only to the button instead of the entire list element, so
that when center key is pressed, it will do the same action as in the
touch mode.

How can I achieve this?
I have tried calling requestFocus() on the button, but still it does
not work.


Focus problem with dpad

by tikky » Tue, 22 Dec 2009 01:18:46 GMT

 I was able to get this working by calling:

Now the button gets focus when navigating with D_PAD.
But now I face another issue.

The textview does not get highlighted when selected. Is there anyway I
can get the textview to be highlighted when focussing on it?



Sponsored Links

Other Threads

1. Can I dynamically switch Adapter of a Gallery

Is it possible for me to dynamically switch the adapter of a Gallery?

In the onCreate() of my activity, I did this:

And then later on in my code, I did

I tried, that but in the emulator, the myGallery never gets update when I do
'setAdapter' again.
How can I force myGallery free up all the items when it was using adapter1
and then makes it repopulate items for anotherAdapter1?

Thank you.


2. appwidget wictionary cant find words and

The sourcecode of the tutorial

does not work on my emulator.

When I try to add the widget to my desktop the widget only remains in
the status "Loading word of day..." which is defined in the

I made a breakpoint in the onUpdate method of the class WordWidget but
it never reaches it.

What did I wrong ?

3. Measurement of Time

4. REG: Xml to Wbxml using EAS

5. testing/understanding weak and strong pointers

6. Retrieving Records from a created Database and put it in a SPINNER

7. How Can I track my messages