View Single Post
Old November 7th, 2012, 09:06 AM   #2 (permalink)
Senior Member
jonbonazza's Avatar
Join Date: Jul 2010
Gender: Male
Posts: 1,936
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 478 Times in 292 Posts

I would suggest creating a sort of splash screen where you load all of your data and populate your data structure. Once this task completes, I would spawn a new activity that contains your UI controls. Java and subsequently Android are event driven in nature. Once you have your UI set up, you will need to register a listener with your button object that will be fired automatically when it is clicked. Inside this listener, you will need to spawn off a new thread that will perform the network related code. When the code completes, you will need to use a Handler object to notify the UI thread that it has completed and to display the result. Rather than using a Thread and Handler object, you can simplify things by using Android's built-in AsyncTask which handles all of the threading issues for you.
My blog, Inverted Keystrokes, is looking for aspiring developers (not necessarily with Android) to post articles. If you have any development experience and are interested in participating, please PM me. =)
jonbonazza is offline  
Reply With Quote