如何将JSONObject作为json文件附加到Android中的eMail Intent?
目前我的代码是:
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");
startActivity(Intent.createChooser(intent, "Send Email"));
答案 0 :(得分:2)
试试这个:
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"));