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. Android-Specific RSS Library

I have been working on an open-source (Apache 2.0) Android library to
read parts of RSS feeds [1]. The library specifically targets the
Android platform by using (Level 1) APIs such as android.net.Uri. The
design features stream parsing with SAX. As a result, the memory
footprint tends to be smaller compared to an equivalent DOM-based
solution. Furthermore, the use of hash tables facilitates the
construction of POJOs.

At the time of writing, this new RSS library can be imported into an
existing mobile app project with the "android update project" command
[2]. Detailed instructions are included in the README. I hope someone
finds this library useful in the making of new or the simplification
of existing Android apps.

Cheers,
Alex

[1] https://github.com/ahorn/android-rss
[2] http://developer.android.com/guide/developing/other-ide.html#libraryProject

-- 

2. BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION intent Extra does not extend 120 sec discovery interval

We documented this problem on 12/22/2010 as Issue 13361 in the Android
Issue Tracker.  There has been no response.  Has anyone else seen this
problem, and, if so, can you pls suggest a workaround?  Thanks!

+++++++++++++++

300 secs was specified as the EXTRA_DISCOVERABLE_DURATION for the
BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE intent.

As expected, the resultCode subsequently returned via
onActivityResult() was 300 -- indicating success. Also the
Settings>Wireless and network>Bluetooth settings were observed and BT
was found to be 'Visible' and the associated countdown timer started
counting down from 300. All looked fined to this point.  However,
after 120 secs elapsed (when the countdown timer read "Visible for 180
seconds") visibility was lost. At this time, the BroadcastReceiver in
our application received an ACTION_SCAN_MODE_CHANGED message
indicating that the scanmode had changed from
SCAN_MODE_CONNECTABLE_DISCOVERABLE to SCAN_MODE_CONNECTABLE.

Though the API and the Settings display initially indicated success,
the EXTRA_DISCOVERABLE_DURATION of 300 seconds was not honored by the
system -- it evidently remains fixed at 120 seconds.

If EXTRA_DISCOVERABLE_DURATION is set to 300 seconds and the
resultCode returned in onActivityResult() is 300, then I expect BT to
be in  SCAN_MODE_CONNECTABLE_DISCOVERABLE mode for 300 secs (not 120
secs).

Env:
Device: SAMSUNG-SGH-I897
Firmware: 2.1-update1
Kernel:2.6.29
Build: ECLAIR.UCJH7



-- 

3. NFC... TAG_DISCOVORED intent is only send via startActivity()

4. How to get application list from android market?

5. hello group

6. How a Drawable could implement Drawable.Callback?

7. Background issue