Spinner Spinner = (Spinner) findViewById(R.id.spinner);
Spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
@Override
public void onItemSelected(AdapterView<?> arg0, View view,
int position, long row_id) {
final Intent intent;
switch(position){
case 1:
intent = new Intent(CurrentActivity.this, TargetActivity1.class);
break;
case 2:
intent = new Intent(CurrentActivity.this, TargetActivity2.class);
break;
// and so on
// .....
}
startActivity(intent);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
Thursday, 6 November 2014
Android: How to start another activity when click on item from spinner items
Labels:
Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment