开发者

onListItemClick generates ForceClose when clicking on item of list

开发者 https://www.devze.com 2023-02-16 01:15 出处:网络
I am using following code: public class myclass extends ListActivity implements OnItemClickListener{ //oncreate()

I am using following code:

public class myclass extends ListActivity implements OnItemClickListener{  
//oncreate()  
   {.............}      
 protected void onListItemClick(ListView l, View v, int position, long id) { 开发者_开发知识库 
        super.onListItemClick(l, v, position, id);

//.....

startActivityForResult(intentname,0);
myclass.this.finish();  
}  
}

Problem is>> When i click any item in list by mouse(for test on vm) it shows Force Close But works fine with Return(Enter) key...

Thanks in advance !!!


you can use this..

place the below given code in OnListItemClickListener..

Object o = this.getListAdapter().getItem(position); String place = o.toString();


You have to @Override the onListItemClick().
Are you doing that?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号