Did you check for the typical bottlenecks? It sounds like you're performing 
intensive tasks on the UI thread, which might explain the lag of 2 seconds 
until the UI is visible. I guess that your web service requests runs on the 
UI thread. And maybe your code accidentally starts that request again when 
coming back from the other activity.

In general you need to avoid the following on the UI thread: any kind of 
I/O like reading/writing files, database access, loading bitmaps, Internet 
requests should be done in a background thread. You can use AsyncTask for 
doing that.

http://developer.android.com/training/articles/perf-anr.html


On Tuesday, November 27, 2012 10:27:56 PM UTC-6, MathieuB wrote:
>
> Hello! 
>
> Here's the situation :
>
> I have a parent activity that have 3 fragments associated with it. 
> Basically, there is the actionBar and three tabs. Each tab holds a fragment 
> in which there is a listview.
>
> The data are the same for all the 3 listviews, just filtered in different 
> way so, in the parent activity, I call a webservice to fetch the data and 
> then I push the data to all three fragments and populate their listviews.
>
> When I select an item from one of the listviews, I land on another 
> activity. The PROBLEM is, when I come back (to the activity with 3 
> fragments), there seems to be a lag from the moment I push the actionbar up 
> button and the activity loads. Tough to explain, but when I hit the up 
> button, it stays selected for about 2 seconds and then switch to the 
> activity.
>
> I'm using setRetainInstance on fragments...other than that, I don't know 
> what could be the cause.
>
> Do you have any idea? Anything common about using fragments and coming 
> back to this activity after leaving it.
>
> Thank you!
>

-- 
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