如何在listview中的setOnItemClickListener中从arraylist获取对象?

时间:2011-08-16 04:36:21

标签: android

  

可能重复:
  how to get object from listview in setOnItemClickListener in android?

我在arrayadapter中添加了arraylist,其中包含每个由两个元素/项组成的对象,我已成功为setListAdapter设置了该适配器,现在我想在listview的setOnItemClickListener中获取这些项。

//tweets - arraylist which contains object
TweetListAdaptor adaptor = new TweetListAdaptor(this,R.layout.list_item, tweets);       
setListAdapter(adaptor); 
  ListView lv = getListView();
  lv.setTextFilterEnabled(true);
  lv.setOnItemClickListener(new OnItemClickListener() 
  {
    public void onItemClick(AdapterView<?> parent, View view,int position, long id) 
    {
         //here i want to get the items             
    }
  });

0 个答案:

没有答案