Hello I'm trying to think of the best way of tackling this - I'm not
using a database or inflating data dynamically so instead I just want
to load a different activity depending on which Spinner selection is
made. I'm in the early stages of working with Android so here's where
I'm at:
public class ItemSelected implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent, View v, int pos,
long id) {
if ((parent.getItemAtPosition(pos).toString()) == "Selection 1")
{
startActivity(new Intent(this, activity_1.class)));
} else if {
// ditto for activity 2 and so on }
}
public void onNothingSelected(AdapterView<?> parent){
Toast.makeText(parent.getContext(), "No selection made",
Toast.LENGTH_LONG).show();
}
}
Would a conditional set of statements work something like this or can
I load the activities through an array as could be done with a simple
set of strings.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en