-4

I am new to android.

In android is it possible to call another class or xml in spinner using onItemselectedListener.

4

3 回答 3

1

是的,当从微调器中选择一个项目时,您可以调用另一个活动,首先您需要覆盖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);

        }
    });
于 2012-12-24T05:58:07.300 回答
1

像这样试试

  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

        }
    })
于 2012-12-24T05:50:31.077 回答
0

使用 Onitemselect 侦听器从微调器调用另一个活动。是的。

于 2012-12-24T07:24:44.440 回答