I don't know if that is the way I would have done it since Android has some nice Handler methods that can do some of what you are looking for then you can block on the thread until your items download. Here is how I make a standard Splash screen. This Splash activity is the main activity in the Manifest, and when its done calls the next activities.
import java.io.File;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
/**
* Splash screen to start the app and maybe check if some things enabled
* If not enabled popup and if user enables then continue else close app.
*/
public class Splash extends Activity {
private static final String TAG = "Splash";
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.splash);
// load some stuff
(new Handler()).postDelayed(new splashHandler(), 2000);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, "OnActivity result code = " + resultCode);
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == -1) {
// class of the next activity you want to display after the Splash screen
Class<?> className = MainApp.class;
startActivity(new Intent(getApplication(), className ));
Splash.this.finish();
} else {
Toast.makeText(Splash.this, getResources().getText(R.string.stringSplashonActivity), Toast.LENGTH_LONG).show();
finish();
// the program...
return;
}
}
/**
* Runnable class to check if user is logged in already
* and then start the correct activity.
*
*/
class splashHandler implements Runnable{
@Override
public void run() {
.....Do something.....
}
}
}
Then don't forget to define the activity between the applicaton tags in the Android Manifest.xml (for those new to Android)
<activity android:name="Splash" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hope this helps....