Android: listview crashes

前端 未结 2 1982
陌清茗
陌清茗 2021-01-28 17:20

I\'m using android listview and its working perfectly fine. my implementation as below

ListView listview = (ListView)findViewById(R.id.list);
setListAdapter(new          


        
2条回答
  •  一生所求
    2021-01-28 17:50

    Try like this.

    Public class ABCD implements OnItemClickListener{
              ListView listview;//class varible
    
               listview = (ListView)findViewById(R.id.list);
               setListAdapter(new ArrayAdapter(MyIncidentActivity.this,
               R.layout.row_incident, R.id.label_incident, db_results));
               listview.setOnItemClickListener(this);
    
            @Override
        public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
    
        }
    
    }
    

提交回复
热议问题