I have an ArrayList I am sending item onItemClick On another activity from this:-
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
Intent i = new Intent(MessageEmail.this, MessageByMessage.class);
i.putExtra("msg_title", unreadMsgList.get(position).address);
i.putExtra("full_msg",
unreadMsgList.get(position).unreadMessage);
i.putExtra("pos", position);
startActivity(i);
finish();
}
});
& get On another activity & set on text from this:-
title=getIntent().getExtras().getString("msg_title");
message=getIntent().getExtras().getString("full_msg");
position=getIntent().getExtras().getInt("pos");
title_txt.setText(title);
msg_txt.setText(message);
Now Problem is that I have a delete button in this activity. I want to delete item on Button click & will switch on my first activity Where List should be refresh.
Thanks in advance!
Deepanker
Use
StartActivityForResult(yourIntent,YOUR_REQUEST_CODE);and on theonActivityResultin the otherActivity simply set some Result in an INTENT and finish() that Activity on Delete Button’s OnClick Event.