When does onFocusChanged() get called

by ying lcs » Wed, 04 Mar 2009 06:57:38 GMT


Sponsored Links
 Hi,

I have over-loaded the onFocusChanged() in my classes which inherits
from LinearLayout.

protected void onFocusChanged(boolean gainFocus, int direction,
                        Rect previouslyFocusedRect)  {
   super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
}

My question is when does onFocusChanged() get called? In this
over-loaded implementation, I set a breakpoint, but it never breaks
there. I have repeated pressing UP/DOWN key, but it never breaks at
that line

Thank you for any pointers.

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



When does onFocusChanged() get called

by Romain Guy » Wed, 04 Mar 2009 06:58:49 GMT


 LinearLayout is not focusable so it cannot get onFocusChanged().






-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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


Sponsored Links


When does onFocusChanged() get called

by ying lcs » Wed, 04 Mar 2009 07:04:15 GMT


 Romain,

Thank you. But if I call setFocusable(true) in my class which
inherited from LinearLayout, will android call onFocusChanged() of my
class?

Thank you again.






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



When does onFocusChanged() get called

by Romain Guy » Wed, 04 Mar 2009 07:06:21 GMT


 Yes.








-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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



Other Threads

1. How to overlay animation upon a View

Hi,all,

I am new to Android and current try to realize a UI that a
drawableAnimation can be floating upon a customized view as a small-
animating widget while I can still focus on and work on the customized
view.

Actually I tried serveral solutions but all failed as follows,

(1) I tried to use the customized view in the main activity and send a
new intent to start another activity to show the small-animating
widget, but the new activity turned to be full-screen and black
background even I set the theme as transprarent(this is also the
confusing isse for me, the new activity is always black background,
event I set transparent attribute in small-animating widget's
overriden OnDraw() method).

(2)I tried to put the small animation widet into a dialog view but
unfortunately it turn to be just another activity and block the main
activity, I have to press the Button BACK to close the small-
animation-showing dialog to use the main activity.

(3)I tried to the SurfaceView. I learned from ApiDemo that implemented
the main activity viewas one of the Surface View and plus the small
animation widget as a normal view in another xml file. But again the
sad thing is I found my customized main activity view had already
inherited from ListView and cannot be multi-inherited.

(4)I also tried to merge the small-animate widget view in to main.xls
and set the zAxis attributes as TOP ,  but it seems not work.

As a result, I am getting a little bit despair about the solutions.
Any better idea to help me out?

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

2. class com.android.camera.UploadService does not exist?

Manifest for Camera.git application lists this service.

I am trying to simply build the Camera application and am unable to do
so.  There have been several small issues (such as a resource file
having values not compatible with the latest SDK), but this one seems
a bit more of a problem ;)...

Anyone successfully built the full (not commented out here and there)
Camera application?

Tips appreciated.

Thanks :)

     Hans
--~--~---------~--~----~------------~-------~--~----~

3. Making things louder

4. List of private / hidden / system APIs?

5. Network activity for each Process (based on PID)

6. Att: group owners, please unsubscribe min...@hanmail.net

7. How to add activity to application to the task history(long press home key)