Listview with Details

后端 未结 4 1849
予麋鹿
予麋鹿 2021-01-17 02:05

i have a Listview which displays list of clients, i have added an onClickListner to Listview so that i can get the detailed information of clicked client.

Li         


        
4条回答
  •  -上瘾入骨i
    2021-01-17 03:03

    If you want to pass Client Name which you are displaying in list, you can get id from adapter and use it.

    @Override
    public void onItemClick(AdapterView parent, View view, int position,
            long id) {
            String clientName= (String) ((TextView) view
                    .findViewById(R.id.client_name)).getText();
            Intent intent = new Intent(this, NextActivity.class);
              intent.putExtra("client", clientName);
                startActivity(intent);
    
            }
        } 
    }
    

提交回复
热议问题