Java android listview和intent
我是android开发新手。我只是想知道如何访问我们导航到的类中的变量(例如textview变量),以便根据listview更改它的值 下面是一些代码Java android listview和intent,java,android,listview,android-intent,Java,Android,Listview,Android Intent,我是android开发新手。我只是想知道如何访问我们导航到的类中的变量(例如textview变量),以便根据listview更改它的值 下面是一些代码 protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id);
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Intent openStartingPoint = new Intent("com.name.MainClass");
startActivity(openStartingPoint);}
谢谢最有效的方法是将信息放在意图中 改为
Intent openStartingPoint = new Intent(this, com.name.MainClass.class);
openStartingPoint.putExtra("position", position);
startActivity(openStartingPoint);}
在Receiving活动的onCreate中,您写道:
Intent openStartingPoint = getIntent();
int position = openStartingPoint.getIntExtra("position");