-1
在我MainActivity
,延伸ListActivity
,我填充的ListView
什么,我想在OnListItemClick
事件做的是我想每次都去相同的布局,但在此基础上我点击的项目,我想以显示不同的数据,更具体地在后面的布局中更改ImageView
上的图像。动态布局模板
在我MainActivity
,延伸ListActivity
,我填充的ListView
什么,我想在OnListItemClick
事件做的是我想每次都去相同的布局,但在此基础上我点击的项目,我想以显示不同的数据,更具体地在后面的布局中更改ImageView
上的图像。动态布局模板
您可以使用带有Intent的Bundle将数据从一个活动传递到另一个活动以启动新活动。
Intent myIntent = new Intent(this, YourOther.class);
Bundle extras = myIntent.getExtras();
extras.putString(key, value);
或者,您可以对Intent本身使用快捷方式。
Intent myIntent = new Intent(this, YourOther.class);
myIntent.putExtra(key,value);
然后在接收活动中,您将数据从Intent中的Bundle中做出类似的操作。
Bundle myBundle = getIntent().getExtras();
String value = myBundle.getString(key)
注:的关键是,必须是一个字符串的唯一的事情,该值可以是任意的基本数据类型。每次都有一种方法。
bool value = myBundle.getBoolean(key)
int value = myBundle.getInt(key)
...
你想根据点击的项目开始另一个'ImageView'的Activity吗? – Wakim
是的,那正是我想要的。 – LighterFluid
看看这篇文章,http://stackoverflow.com/questions/6289227/how-to-go-to-a-particular-activity-on-list-item-click,这必须帮助你实现你的目标。 – Wakim