You can't have multiple activities on top at the same time. Are you trying to have them run in order, one after the other?
One way to accomplish this is to start each activity for result:
Intent intent = new Intent(this, MyActivity.class);
startActivityForResult(intent, 0);
Where you use the request code to track when activity is running. Then, in onActivityResult you can start the next one:
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
if (requestCode < NUM_ACTIVITIES) {
Intent intent = new Intent(this, MyActivity.class);
startActivityForResult(intent, requestCode + 1);
}
}
Edit:
If you want to have some of the activities immediatly in the background, you can chain them together by calling startActivity in each Activity's onCreate. If you start a new Activity in onCreate before creating any views, the activity will never be visible.
protected void onCreate (Bundle savedInstanceState) {
int numLeft = getIntent().getIntExtra("numLeft");
if (numLeft > 0) {
Intent intent = new Intent(this, MyActivity.class);
intent.putExtra("numLeft", numLeft - 1);
startActivity(intent);
}
}
This should accomplish the stack that you wanted..