Balajee Annamalai
Balajee Annamalai

Reputation: 165

how to load data fast from webservice in android?

Am access data from web service,but when moving from one activity to other its showing black screen till that get loaded then its displaying my activity.

how to avoid black screen and access data fast?

code:

JSONObject json = getJSONfromURL(url);   
HttpClient httpclient = new DefaultHttpClient(); 
HttpPost httppost = new HttpPost(url);
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();is =entity.getContent();

Upvotes: 1

Views: 2142

Answers (2)

Shivani Khandelwal
Shivani Khandelwal

Reputation: 151

Use Asynchronous Task to display progress dialog when it is performing parsing. do in background method write all code that you perform and the on post method show result.

Upvotes: 0

bytebender
bytebender

Reputation: 7491

Here is a AsyncTask example - http://www.vogella.com/articles/AndroidPerformance/article.html

Here is a Progress dialogue example - http://www.vogella.com/articles/AndroidDialogs/article.html

should get you started in the right direction.

Upvotes: 4

Related Questions