【发布时间】:2016-01-11 13:03:33
【问题描述】:
我正在开发一个具有可点击列表视图的应用程序。我在列表视图上方创建了一个搜索过滤器,它运行良好。当我点击不同的项目时,我会在另一个很好的活动中获得它们的相应详细信息。但是,当我使用搜索过滤器搜索同一项目时,我会在其他位置获取详细信息。怎么找回原来的位置?这是我的代码:
代码:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
//we use the items of the listview as title of the next activity
String course = listAdapter.getItem(position);
//we retrieve the description of the juices from an array defined in arrays.xml
String[] description = getResources().getStringArray(R.array.description);
final String courselabel = description[position];
//retrieve content for the dialog
String[] dialogmessage = getResources().getStringArray(R.array.dialogmessage);
final String dialogmsg = dialogmessage[position];
Intent intent = new Intent(getApplicationContext(), MainActivityas.class);
intent.putExtra("message", message);
startActivity(intent);
}
【问题讨论】:
标签: android listview android-listview