I need to transfer the msgID wich is got from json to FragmentB,but i can't get it to work , the obly thing that transfers is the last id parsed from json
This is how i get my MsgID
for(int i=0;i<messages.length();i++){
JSONObject c = messages.getJSONObject(i);
read_status=c.getString(TAG_READ_STATUS);
if(read_status.equals("unread")){
msgID=c.getString(TAG_ID);
Log.d("BUNDLE ID", String.valueOf(msgID));
title = c.getString(TAG_TITLE);
time=c.getString(TAG_TIME);
HashMap<String, String> map = new HashMap<String, String>();
map.put(TAG_TITLE, title);
map.put(TAG_TIME, time);
map.put(TAG_ID, msgID);
mailList.add(map);
}
}
Here is how i pass it to FragmentB but as i said it passes only the last id parsed from json
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
bundle.putString("message",msgID);
FragmentManager fm=getFragmentManager();
FragmentTransaction transaction=fm.beginTransaction();
//bundle.putString("message",msgID);
MessageView ViewMessages=new MessageView();
ViewMessages.setArguments(bundle);
transaction.replace(R.id.fragmentInnerMail,ViewMessages);
transaction.commit();
}
please help
0 comments:
Post a Comment