0
首先,我想知道什么是列表视图项的索引?就像数组的索引(a [0],a [1] ....)。
其实我想得到列表项的索引。它始终显示我-1 这里是代码。
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Object index = getListAdapter().getItem(position);
Intent myIntent = new Intent(this, newsdisplay.class);
//Create the view using FirstGroup's LocalActivityManager
View view = newsgroup.group.getLocalActivityManager()
.startActivity("show_city", myIntent
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
//Again, replace the view
newsgroup.group.replaceView(view);
}
请帮助我如何获取列表视图项目的索引,并且这是独一无二的其他项目?