All Activity callbacks (onCreate, onStart, etc.) are called by Android on one thread - called the UI thread.

To keep your application responsive, Android has a time limit for each of these callbacks. If you take longer than that, the user is shown the ANR (Application Not Responding) dialog.

What this means is that you can't do any operations that take indeterminate or just long amount of time on the main thread. Connecting to a network host (or any network operation) is one such thing that you can't do.

Take a look at AsyncTask, it makes it really easy to create a background thread for your network operations, and update the UI with progress and result information.

http://developer.android.com/reference/android/os/AsyncTask.html

-- Kostya

02.11.2010 8:37, pramod.deore пишет:
I think I missed something. Because when I tried xml parsing code from
http://www.anddev.org/parsing_xml_from_the_net_-_using_the_saxparser-t353.html.
Then also it gives me output as The operation timed out. Means when I
tried to connect to internet then it show this message.

On Nov 2, 10:28 am, "pramod.deore"<deore.pramo...@gmail.com>  wrote:
But if I print some statement before while loop then also it is not
printed. I really don't understand what's going on?

On Nov 2, 10:18 am, Frank Weiss<fewe...@gmail.com>  wrote:

The loop in your code blocks on bis.read() for as long as it takes to get
the next byte from the server over the network. I'm sure you understand that
that loop can take many seconds, even minutes to finish, depending on many
factors. During that time, creation of your activity is effectivity in
limbo. The Android OS won't let the onCreate method of your activity run for
that long.



--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to