new_perl
new_perl

Reputation: 7755

How do I start an invisible activity and then make it visible when ready?

I want to start activity B from A

But B takes quite some time to initialize

So I want to delay switching the view until B is ready.

Is there a way to start an invisible activity B and then make it visible when ready?

Upvotes: 0

Views: 1055

Answers (2)

AAnkit
AAnkit

Reputation: 27549

Why don't you just try using AsyncTask. You can follow below steps !!

1) start Activity B , show a progressBar that can say "Screen is loading".

2) Load your screen into AsyncTask.

3) And when it is done remove the progress bar/dialog and show the screen, it is very Simple.

AsyncTask Docs

Upvotes: 1

Ran
Ran

Reputation: 4147

Start a background thread (AsyncTask for example) from activity A that it will do the initialization. When the AsyncTask finishes, start activity B.

Upvotes: 0

Related Questions