I am new to android.
In android is it possible to call another class or xml in spinner using onItemselectedListener
.
I am new to android.
In android is it possible to call another class or xml in spinner using onItemselectedListener
.
是的,当从微调器中选择一个项目时,您可以调用另一个活动,首先您需要覆盖onItemSelected()
,
mySpinner.setOnItemSelectedListener(new OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3)
{
// Create the intent to start new activity
Intent i = new Intent(CurrentActivityName.this, NextActivityName.class);
i.setflags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}
});
像这样试试
mList.setOnItemSelectedListener(new OnItemSelectedListener()
{
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3)
{
// start ur activity
}
@Override
public void onNothingSelected(AdapterView<?> arg0)
{
// TODO Auto-generated method stub
}
})
使用 Onitemselect 侦听器从微调器调用另一个活动。是的。