所以这个问题有点难以解释,但基本上我想要的是有一个列表视图的数组列表,但更改列表视图上的标题。因此,当用户看到列表视图时,它会说一件事,但会传递不同的信息。这是我的代码:
//the string names
String names[] = { "item1", "item2"};
我有 2 个名为 item1.java 和 item2.java 的类,当单击一个列表项时,它会设置一个等于活动名称的类并像这样打开它:
protected void onListItemClick(ListView lv, View v, int position, long id){
super.onListItemClick(lv, v, position, id);
String openClass = names[position];
try{
Class selected = Class.forName("com.example.example." + openClass);
Intent selectedIntent = new Intent(this, selected);
startActivity(selectedIntent);
}catch (ClassNotFoundException e){
e.printStackTrace();
}
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
finish();
}
但是在列表视图中我不想让它说“item1”和“item2”....有没有办法像别名或其他东西一样?抱歉,如果我的问题难以理解,我已尽力解释我需要帮助的内容,如果您对我的问题有任何疑问,请告诉我(:感谢您的帮助