public void onListItemClick(ListView parent, View v, int position, long id) {
Intent intent = new Intent(this, HaberGoster.class);
startActivityForResult(intent, position);
}
这是我在listview上点击标记时启动新活动的代码。问题是,当我点击标签时,我想在HaberGoster.class
获得位置我该怎么做才能在其他课程中获得listview的位置
答案 0 :(得分:2)
您可以通过将该位置置于意图中来“发送”该位置。
intent.putExtra("position", position);
然后在第二节课中阅读:
Bundle extras = getIntent().getExtras();
int position = extras.getInt("position");