Skip to content Skip to sidebar Skip to footer

Setcontentview Taking Long Time (10-15 Seconds) To Execute

I have a large activity that contains 100 or more buttons. But it's working fine once loaded. Problem however is loading. From clicking its launch icon to getting the first view it

Solution 1:

You are loading data on same UI thread , so nothing will be desplayed during the time of loading . Use Async Task for loading in separate thread.

1)Show a progressBar in onPreExecute() 2)load data in doInBackground() . no UI related stuff here 3) Update changes on UI ,hide progressBar in onPostExecute()

Solution 2:

Use this code before setContentView() is called. Maybe it helps.

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
requestWindowFeature(Window.FEATURE_PROGRESS);

setProgressBarIndeterminateVisibility(true);
setProgressBarVisibility(true);

Post a Comment for "Setcontentview Taking Long Time (10-15 Seconds) To Execute"