Skip to content Skip to sidebar Skip to footer

Attach Json File To Email Intent In Android

how can I attach a JSONObject as a json File to a eMail Intent in Android? My code for this is at the moment: JSONObject jsonObj = new JSONObject('text'); Intent intent = new Inten

Solution 1:

Try this:

JSONObject jsonObj = new JSONObject("text");
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, "blabla");
intent.putExtra(Intent.EXTRA_SUBJECT, "blabla");
intent.putExtra(Intent.EXTRA_TEXT, "blabla");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/file.json"));
startActivity(Intent.createChooser(intent, "Send Email"));

Post a Comment for "Attach Json File To Email Intent In Android"