0

我已经准确定义了活动,但我无法从 lview1.getSelectedItemPosition() 开始活动。当我单击列表视图项目时,什么也没发生。Eclipse 没有抛出错误。什么不见​​了?

我没有粘贴导入行

package com.batteryproject;

public class Anamenu extends Activity
{

private String lview_arr[]={"Şarj Azaldı Alarmı","Şarj Doldu Alarmı","Hırsız Alarmı"};
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.anamenu);

final ListView lview1=(ListView)findViewById(R.id.ListView01);
lview1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lview_arr));
//lview1.setTextFilterEnabled(true);
lview1.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
    int selected=lview1.getSelectedItemPosition();
    switch(selected){

    case 0:
    Intent intent=new Intent("com.batteryproject.ALTMENU1");
    startActivity(intent);
    break;

    case 1 :
    Intent intent2=new Intent("com.batteryproject.ALTMENU2");
    startActivity(intent2);
    break;

    case 2 :
    Intent intent3=new Intent("com.batteryproject.ALTMENU3");
    startActivity(intent3);
    break;

    }
}
});
}}
4

1 回答 1

0

更改getSelectedItemPosition()position

于 2013-10-07T15:33:08.867 回答