ok am having a funny problem here, scenario is like this:
Intent i of Activity “B” calls Activity “A” and the method in onCreate() of Activity “A” runs;
intent j of activity “B” calls Activity “A” and puts an “Int” extra which i can use to call a method in Activity “A”
intent x, y and z of TabActivity “C” calls Activity “A” and puts a “String” Extra in other to start a different method in Activity “A”;
problem am having is that, regardless of what i put in the intent of Activity “C”, the method from intent j keeps executing.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
fillData(); // intent i of Activity B
HandleIntent(getIntent()); // other intents
}
public void HandleIntent(Intent intent){
getIntent();
if(getIntent().getExtras() != null){
int priorityrequest = intent.getIntExtra("com.MyApp.PriorityRequestCode" PRIORITY_REQUEST_CODE);
if(priorityrequest == 1){
PSData(); // from intent j of Activity B this keeps executing
}
int homerequest = intent.getIntExtra("com.MyApp.HomeRequestCode", HOME_REQUEST_CODE);
if(homerequest == 3){
HomeData(); // doesn't execute keeps executing PSData();
}
}
}
public void onNewIntent(Intent newIntent){
HandleIntent(getIntent());
super.onNewIntent(newIntent);
}
From the code, PSData() keeps executing regardless of if i send another intent from another activity with the HOME_REQUEST_CODE. or is it possible to get Intent from a specific class or activity?…
In
intent.getIntExtra("com.MyApp.PriorityRequestCode" PRIORITY_REQUEST_CODE);a comma is missing:intent.getIntExtra("com.MyApp.PriorityRequestCode", PRIORITY_REQUEST_CODE);is the default value of PRIORITY_REQUEST_CODE = 1?
Since you compare to a specific value and maybe you don’t need a default value, you can try this sintax