How can I set onClickListener on ArrayAdapter?

后端 未结 4 1515
半阙折子戏
半阙折子戏 2020-12-03 00:23

I\'m making class like as below

// All necessary imports are here

public class More extends Activity {

    String[] MoreItems = { \"Transfers\", \"Budgets\         


        
4条回答
  •  眼角桃花
    2020-12-03 01:23

    For example:

     ListView lv = getListView();
    
            lv.setAdapter(listAdapter); 
    
            lv.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView parent, View view,int position, long id) {
    
                    Intent i = new Intent(More.this, NextActvity.class);
                   //If you wanna send any data to nextActicity.class you can use
                     i.putExtra(String key, value.get(position));
    
                startActivity(i);
                }
              });
    

提交回复
热议问题