Hello,
I have 2 activities.
Activity 1 is the 'Homepage' which consists of one spinner.
Activity 2 will be started once an item from the spinner has been selected in Activity 1. The value of the item will also be passed into Activity 2.
Actvity 2 also has the same spinner as Actvity 1.
I would like to make a varible (TABLE_NAME in the code below) whose value will be the selection made in Activity 1 when Activity 2 is initally started but after that the variable value will be the selection made in Activity 2.
Is there an easy way to identify if an activity has just been started?
I've tried to show what I want in the code below:
public class MyOnItemSelectedListener implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
if(this activity was just started)
{Intent sender=getIntent();
String TABLE_NAME=sender.getExtras().getString("TABLE_NAME");}
else
{TABLE_NAME = parent.getItemAtPosition(pos).toString();}
Cursor cursor = getStats(TABLE_NAME);
showStats(cursor);
}
public void onNothingSelected(AdapterView<?> parent) {
// Do nothing.
}
}