onitemclicklistener与2个微调器连接

时间:2013-12-20 13:29:06

标签: java android android-spinner

  Spinner Spte1;
  String[] path1 ={"Celsius", "Kelvin","Farenheit"};


  Spinner Spte2;
  String[] path2 ={"Celsius","Kelvin","Farenheit"};

  EditText ETTE1;
  EditText ETTE2;

现在是第二个代码

Override
    public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
            long arg3) {
        // TODO Auto-generated method stub
        int position1 = Spte1.getSelectedItemPosition();
        switch (position1){

        case 0:


            break;

        case 1:

            break;
        case 2:

            break ;
            }
    }

但是我需要制作代码以在第一个微调器中的第一个项目之间进行选择并在第一个文本中连接第二个微调器和广告号然后在第二个文本中重新调整我需要代码让我做出这个动作 欣赏。

1 个答案:

答案 0 :(得分:1)

你需要这样的东西:

    switch(parent.getId()) {
    case R.id.listview1:    
       // do something for the 1st spinner      
        break;
    case R.id.listview2:
        break;
       // do something for the 2nd spinner
    }