tags:

views:

11

answers:

1

hi .. i have some problem with "how android manage its activity called from another activity"

i m using the following code... whenever i execute the program on the device... it execute the "second "activity first before executing the "first" activity. program display the "second" acitivy first. after pressing back button it display the "first" activity. but i need to execute them in calling sequence as we call methods in java. plz help me if anybody know it....... thanx in advance.

package com.example.ggandroid; import android.content.Intent; import android.app.Activity; import android.os.Bundle;

public class RelLayoutdemo extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main); Intent first = new Intent(this, VideoViewDemo.class); //first.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(first);

   Intent second = new Intent(this, tableview.class);
  this.startActivity(second);

} }

A: 

There isn't an FIFO ordered a queue of things to be done that you can fill up in this way.

You will need to re-architect your system, for example, you could use startActivityForResult() on the first activity and only launch the second after you get the result. Or you could have the first activity launch the second.

If those activities already exist and you can't modify them, you may be out of luck. (Assuming that the activity stack is LIFO like and launching the second activity first might work on occasion but is probably not reliable)

Chris Stratton