У меня небольшая проблема с отправкой правильного идентификатора в другое мероприятие в качестве дополнительного. Я получаю идентификатор из базы данных, которую я отправляю новому действию, чтобы я мог получить правильные данные.Но проблема в том, что мой код отправляет только последний идентификатор, который находится в массиве.Как я могу это исправить?
Вот код, который я использую:
for(cursorTitle.move(0); cursorTitle.moveToNext(); cursorTitle.isAfterLast()) {
if (vf != null) {
vf.removeAllViews();
}
text = cursorTitle.getString(cursorTitle.getColumnIndex("title"));
cardsCount = cursorTitle.getString(cursorTitle.getColumnIndex("cardsCount"));
collId = Integer.parseInt(cursorTitle.getString(cursorTitle.getColumnIndex("objectId")));
Log.i("CollID","Collection ID : "+collId);
b = BitmapFactory.decodeFile("/sdcard/7073d92dce10884554d7e047f1c51cb6.jpg", null);
array = new ArrayList<Integer>();
array.add(collId);
vf = new ViewFlipper(MyCollectionList.this);
myListView = new ListView(MyCollectionList.this);
hm = new HashMap<String, Object>();
hm.put(IMAGE, b);
hm.put(TITLE, text);
hm.put(CARDS_COUNT, cardsCount +" Stampii");
items.add(hm);
final SimpleAdapter adapter = new SimpleAdapter(MyCollectionList.this, items, R.layout.main_listview,
new String[]{TITLE, CARDS_COUNT, IMAGE}, new int[]{ R.id.main_name, R.id.main_info, R.id.main_img});
myListView.setAdapter(adapter);
myListView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> a, View v, int position, long id)
{
Intent previewMessage = new Intent(getParent(), MyCollectionId.class);
previewMessage.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
previewMessage.putExtra("collection_id", array.get(position));
parentActivity.startChildActivity("MyCollectionId", previewMessage);
}
});
}
Заранее спасибо!