Ahsan wrote:
> Dear Friends,
>
> I think I have put some time intensive work in the main UI of my code. I
> was trying to use handlers/threads at the main UI instead. However, this
> is not working out. I am not very sure why. This is what I did --
>
> * inside onCreate:
>
> - - - - - - - .................................
> Thread thread = new Thread(this);
> thread.start();
> - - - - - - - .................................
>
> * inside run() (1 line only)
>
> handler.sendEmptyMessage(0);
>
> * inside private Handler handler = new Handler() {
> @Override public void handleMessage(Message msg)
>
> (everything I was doing - downloading the JSON file, parsing it, using
> its information to overlay google map !)
>
> Please suggest me a way. I think I am not doing things the right way
> :(... (since the threaded thing is not working out fine :(....)
For asynchronous tasks, consider using AsyncTask. Here is a sample
project, from one of my books, of using AsyncTask to simulate retrieving
map points, then putting them in an ItemizedOverlay:
http://github.com/commonsguy/cw-advandroid/tree/master/Maps/NooYawkAsync/
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android App Developer Books: http://commonsware.com/books
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
To unsubscribe, reply using "remove me" as the subject.