Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Ayman Bitar
Ayman Bitar
9,462 Points

Run all AsyncTasks at start

Basically My app currently opens and displays a tabHost and has 4 tabs(each is actually a fragment).

The app can swipe left and right perfectly.

However the asyncTask of the other fragments only start when i hover over their image.

How can make that all the asynctask of these fragments run without hover over.

Thanks

2 Answers

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi Ayman,

I'm catching up on posts that I missed. I don't quite understand the issue without some code...do you have some code you can paste in here for us to take a look at? Where are you spawning the AsyncTasks?

Ayman Bitar
Ayman Bitar
9,462 Points

Hi Ben,

Okay i have progressed a lot in my Application at the moment.

At the moment my application is divided into 3 parts.

Splash Screen - Categories - Articles Splash Screen stats off as just an image, and i directly start the 1st Category asyntask. When it finishes loading, it will take me to the categories section of the app. (In which it has 4 tabs, and each tab page is a fragment). Now the loading of the other 3 categories, only happen when the user goes to that fragment. [Is there a way to load them all without having the user to go to that fragment].

On every Fragment, there is an asyntask for that category. The first call always happen when the user hovers over it.

When a post is clicked in the category section, it will take me to the Article section of the app. [Everything there is fine for now].

Let me know which part of the code you want, so i don't paste everything and make it an unreadable post.

Best, Ayman