我在程序中使用了自定义列表视图,我想在列表视图中选择一个项目,该项目将显示在第二个活动的文本视图中。
我的代码:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String lvalue= itemArrayList.toString();
Intent intent=new Intent(Home.this,Liner.class);
intent.putExtra(String.valueOf(listView),lvalue);
startActivity(intent);
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener((
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String lvalue = (listView.getItemAtPosition(position));
Intent intent=new Intent(Home.this,Liner.class);
intent.putExtra("name",lvalue);
startActivity(intent);
}
}(;