Dhoni Singh Dhoni Singh - 7 months ago 20
Java Question

pass arraylist via implicit intent

I want to pass my arraylist via implicit intent just because I want to send my data in listview via whatsapp. Here is my code

public void save()
{

ArrayList<String> arrayList= new ArrayList<String>(Arrays.asList(combination));


Intent intent= new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");

intent.putStringArrayListExtra(Intent.EXTRA_TEXT,arrayList);

startActivity(intent);
}


save()
is a method that gets called when user presses SHARE button. But it actually doesn't pass anything to whatsapp.

Answer

Concatenate your strings together into one single string. Then, use that as your EXTRA_TEXT value. No application will be expecting an ArrayList<String> as the EXTRA_TEXT value, and so your existing code will not work.