0
feed
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(getApplicationContext(),"position is "+ position, Toast.LENGTH_SHORT).show();
Intent i = new Intent(getApplicationContext(), DetailActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Log.d("listview", "variables: "+ ((Location2) places.get(position)).getName()+" ");
Log.d("listview", "variables: "+ ((Location2) places.get(position)).getImage()+" ");
Log.d("listview", "variables: "+ ((Location2) places.get(position)).getDiscription()+" ");
i.putExtra("name", ((Location2) places.get(position)).getName());
i.putExtra("pic", ((Location2) places.get(position)).getImage());
i.putExtra("disc", ((Location2) places.get(position)).getDiscription());
getApplicationContext().startActivity(i);
}
});
所有的數據是存在的,在日誌中打印出來,但只有當它是位置0startActivity運行在列表視圖的第一個元素,但多數民衆贊成它
logcat的變量發生?無論如何,避免getApplicationContext!使用TopClass.this.startActivity –
是啊所有的LogCat變量都發生了 –
您是否嘗試過改變startActivity調用? –