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. Bluetooth connect: Service Discovery Failed

Hello everyone.

I am building a Bluetooth based application using Android. To debug
the application I am using these two devices:

-Nexus S
-LG P500

Following the Documentation on the Android Web Site:
http://developer.android.com/guide/topics/wireless/bluetooth.html
I have built a server and a client module.

When trying to connect to the devices I am using the following
routine:

Server:

mServerSocket = mBluetoothAdapter
                                                
.listenUsingRfcommWithServiceRecord("app", CTRLUUID);
mDeviceSocket = mServerSocket.accept();

Client:

mServerSocket = d.createRfcommSocketToServiceRecord(CTRLUUID);
mServerSocket.connect();

In certain cases I am able to interconnect the two devices. During
development in the past two weeks I repeatedly ran into the following
IOexception when connection from the client:

"Service discovery failed"

Although my Server side is accepting the connection.

I already found posts discussing similar problems although never in
the form of an "Android to Android" application.

What I noticed was the following behaviour:

If I start the server and wait a few seconds until I try to connect
with the client, chances are very high the connection is established.
I suspect, that if my continually tries to connect to an offline
server, the service discovery table somewhere caches the result and
does not really "look" for a new server the next time it tries to
connect. I tried to find a workaround for about a week now and am left
with adding a "Thread.sleep(10000)" before retrying to connect - which
is not really a solution.

Has anyone else been experiencing similar issues?

Thanks in advance!
Manuel

-- 

2. Android emulator "FTPClient" throws exception when trying to retrieve a file from a Ftp server

I am trying to retrieve a file from my local ftp server "Note: both
the client & server are local running on the same machine". I use
"pyftpdlib" library for running my python server & "FTPClient" library
for my Android Client.

What happens is the that the client gets connected and logged in. The
client is running in Local Passive Mode. But when calling the
client.retrieveFile(.....);. I get an Exception on the emulator saying
"Exception/ip:port - Connection refused".

Here is my client code:

FTPClient client = new FTPClient();
try{
client.connect("10.0.2.2",5000);
client.enterLocalPassiveMode();
boolean login = client.login("User", "1234");
 if (login) {
    File file = new File(getExternalFilesDir(null), "test.txt");
    OutputStream fos = new BufferedOutputStream(new
FileOutputStream(file));
    client.retrieveFile("/testing/test.txt", fos);}
    else client.disconnect();
    }catch (IOException e) {
System.out.println(e.getMessage());
            e.printStackTrace();
        }

This is a screenshot of what happens on the server side: http://bit.ly/hS6BCc

When I tried deleting a file on the server through the client it
worked well. But I faced the problem mentioned when trying to download
a file or uploading a file on the server.
Any Help please, Thanks in advance.

-- 

3. Android emulator closes the connection when receiving data from server

4. Need Help to Develope my first Android Project.

5. What is the permission SET_WALLPAPER_HINTS used for?

6. Important: XmlPullParserException while accessing SOAP webservice

7. ContentProvider for streaming date from one app to another