在Android中如何使用.get[position]
and name
in .putextra
,以及如何使用数组?position
putextra
ainListView = (ListView) findViewById( R.id.mainListView );
mainListView.setOnItemClickListener(new OnItemClickListener() {
int[] myImageList = new int[]{R.drawable.koala_copy, R.drawable.lighthouse_copy};
public void onItemClick(AdapterView<?> parent, View view, int pos,
long id) {
Intent b = new Intent(SimpleListViewActivity.this, Nextclass.class);
b.putExtra("Name", myImageList.get[position]);
b.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finish();
startActivity(b);
}
private ArrayAdapter<String> getListAdapter() {
// TODO Auto-generated method stub
return null;
}
});