我正在插入 ListView 3 个变量,但我只显示 2 个。KEY_NAME 和 KEY_SUM 并且工作正常。我还放置了我不希望用户看到的第三个变量 KEY_WIK。用户单击该值时如何获取 KEY_WIK?
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(),
menuItems, android.R.layout.simple_list_item_2,
new String[] { "KEY_NAME", "KEY_SUM", "KEY_WIK" }, new int[] {
android.R.id.text1, android.R.id.text2 });
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
String GName = ((TextView) view.findViewById(android.R.id.text1)).getText().toString();
String GSum = ((TextView) view.findViewById(android.R.id.text2)).getText().toString();
//String GWik = ?
}
});