我到处寻找类似的解决方案,但一无所获;是否可以使用微调器移动到另一个活动?我试图简单地从 switch case 开始明确的意图,但它不起作用
这是我的代码:
//add new movie spinner and callback
ArrayList<String> addOptions = new ArrayList<String>();
addOptions.add("Add manually");
addOptions.add("Add via web");
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,addOptions);
addMovieSpinner.setAdapter(spinnerAdapter);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
addMovieSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long i) {
switch (position) {
case 0:
Intent intent = new Intent(Home.this, Edit.class);
break;
case 1:
Intent intent1 = new Intent(Home.this, Edit.class);
break;
default:
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});