Android extras=intent.getExtras(); item\u position=extras.getString(FirstActivity.CRRNT\u行号); listitem=(ArrayList)extras.getSerializable(FirstActivity.listitem); 位置=整数.parseInt(项目位置); currentlistitem=listitem.get(位置); 字符串a=currentlistitem.getA(); 字符串b=currentlistitem.getB();
对于所有这些实现,您必须在活动和Android extras=intent.getExtras(); item\u position=extras.getString(FirstActivity.CRRNT\u行号); listitem=(ArrayList)extras.getSerializable(FirstActivity.listitem); 位置=整数.parseInt(项目位置); currentlistitem=listitem.get(位置); 字符串a=currentlistitem.getA(); 字符串b=currentlistitem.getB();,android,json,listview,android-activity,Android,Json,Listview,Android Activity,对于所有这些实现,您必须在活动和LoadUsers(Getter/Setter)类中实现Serializable接口 希望这有帮助 您可以将您在列表视图中单击的阵列列表和项目位置传递给如下新活动-- listView.setOnItemClickListener(新的AdapterView.OnItemClickListener(){ public void onItemClick(AdapterView父对象、视图、整型位置、长id) { String item_position=String
LoadUsers
(Getter/Setter)类中实现Serializable
接口
希望这有帮助 您可以将您在
列表视图中单击的阵列列表
和项目位置
传递给如下新活动--
listView.setOnItemClickListener(新的AdapterView.OnItemClickListener(){
public void onItemClick(AdapterView父对象、视图、整型位置、长id)
{
String item_position=String.valueOf(position);
ArrayList full_listitem=listitem;
意向意向=新意向(上下文,SecondActivity.class);
Bundle extras=新Bundle();
额外输入字符串(CRRNT行号、项目位置);
额外的putSerializable(LISTITEM、full_LISTITEM);
意图.临时演员(临时演员);
星触觉(意向);
}
});
在第二个活动中,您必须使用以下代码接收这些信息--
Intent-Intent=getIntent();
Bundle extras=intent.getExtras();
item\u position=extras.getString(FirstActivity.CRRNT\u行号);
listitem=(ArrayList)extras.getSerializable(FirstActivity.listitem);
位置=整数.parseInt(项目位置);
currentlistitem=listitem.get(位置);
字符串a=currentlistitem.getA();
字符串b=currentlistitem.getB();
对于所有这些实现,您必须在活动和LoadUsers
(Getter/Setter)类中实现Serializable
接口
希望这有帮助 修改你的鼠标点击方式如下:
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(this, "Item Clicked: " + position, Toast.LENGTH_SHORT).show();
TextView title = (TextView) view.findViewById(R.id.title);
String title_text = title.getText().toString();
TextView email = (TextView) view.findViewById(R.id.lvemail);
String email_text = email.getText().toString();
TextView phone = (TextView) view.findViewById(R.id.lvphone);
String phone_text = phone.getText().toString();
Intent i = new Intent(Details.this, onDetailsSelect.class);
i.putExtra("title_intent", title_text);
i.putExtra("email_intent", email_text);
i.putExtra("phone_intent", phone_text);
startActivity(i);
}
按如下方式修改您的McClick:
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(this, "Item Clicked: " + position, Toast.LENGTH_SHORT).show();
TextView title = (TextView) view.findViewById(R.id.title);
String title_text = title.getText().toString();
TextView email = (TextView) view.findViewById(R.id.lvemail);
String email_text = email.getText().toString();
TextView phone = (TextView) view.findViewById(R.id.lvphone);
String phone_text = phone.getText().toString();
Intent i = new Intent(Details.this, onDetailsSelect.class);
i.putExtra("title_intent", title_text);
i.putExtra("email_intent", email_text);
i.putExtra("phone_intent", phone_text);
startActivity(i);
}
工作起来很有魅力。谢谢,很有魅力。非常感谢。
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(this, "Item Clicked: " + position, Toast.LENGTH_SHORT).show();
TextView title = (TextView) view.findViewById(R.id.title);
String title_text = title.getText().toString();
TextView email = (TextView) view.findViewById(R.id.lvemail);
String email_text = email.getText().toString();
TextView phone = (TextView) view.findViewById(R.id.lvphone);
String phone_text = phone.getText().toString();
Intent i = new Intent(Details.this, onDetailsSelect.class);
i.putExtra("title_intent", title_text);
i.putExtra("email_intent", email_text);
i.putExtra("phone_intent", phone_text);
startActivity(i);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail);
Intent i = getIntent();
String title = i.getStringExtra("title_intent");
String email = i.getStringExtra("email_intent");
String phone = i.getStringExtra("phone_intent");
}