I am making a mailing app. What I want to do is open list chooseContactsActivity from composeMailActivity, select some contacts and click add to send them back to composeMailActivity. First thing I did was that standard passing between activities where I passed a string, and the correct string was passed and recognized in composeMailActivity. Then I added arrayList of strings - of contact ids. In chooseContactsActivity it is recognized correctly when debugging, but in the composeMailActivity it returns null.
Some of the answers I tried include: 1, 2, 3, 4, 5...
ChooseContactsActivity:
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ArrayList<String> selectedIds = adapter.selectedIds;
String text = "abc";
Intent intent = new Intent();
intent.putStringArrayListExtra("contacts_added", selectedIds);
setResult(RESULT_OK, intent);
finish();
}
});
ComposeMailActivity:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
ArrayList<String> get_contacts = getIntent().getExtras().getStringArrayList("contacts_added");
}
}
}