RE6
RE6

Reputation: 2724

How to run activity without showing it?


I have an activity (A) and activity (B). A is responsible for loading information, and B is the main activity. In B there are also loading operations which are realted to the UI (listeners, for example). I want to show activity A, and run activity B, but I want that B will be shown only when the loading (of B) was finished (I have a ProgressDialog in A). How can I do this? Thanks!

Upvotes: 0

Views: 340

Answers (3)

type-a1pha
type-a1pha

Reputation: 1893

You can use Fragments to achieve what you want!
http://developer.android.com/guide/components/fragments.html
Cit: "However, a fragment is not required to be a part of the activity layout; you may also use a fragment without its own UI as an invisible worker for the activity."
If you use the support library you dont have to worry about your SDK target.

Upvotes: 0

sschrass
sschrass

Reputation: 7166

It sounds to me that the tasks of A are more suitable to a thread than an Activity.

Upvotes: 2

Mus
Mus

Reputation: 1860

This seems more of an architecture problem. You might want to reconsider using two activities. You can use AsyncTask in a single activity to do this.

Upvotes: 0

Related Questions