views:

84

answers:

2

What's the best way to create a reusable loading screen in Android? The loading screen should have a background image and a loading indicator.

Should I use a separate activity?

+2  A: 

The best way is using a separate activity with a SurfaceView that shows the image. Then, you can create an overlay that contains the ProgressBar.

Cristian
Should you remove the loading activity from the stack before calling the main activity?
hgpc
I'd finish the parent activity once the child activity has been started. Or... you can use the same activity and change its layout.
Cristian
A: 

You just could define your own dialog with custom layout. You would handle what happens if your progress screen gets cancelled (pressing back button). You could also prevent it from happening too.

By using an standard dialog you take adavantage of nice efects (background activity darkening with upgrades) and prevents user from interacting with background activity while it is on.

Fernando Miguélez