5
मैं ईमेल के माध्यम से कई फाइलें भेजना चाहता हूं। मुझे यह Android multiple email attachments using Intent मिला लेकिन यह काम करता है और मुझे कोई त्रुटि संदेश नहीं मिलता है। यह सिर्फ फाइलों को संलग्न नहीं करता है (मैंने केवल एक फ़ाइल भेजने की कोशिश की लेकिन मुझे एक ही परिणाम मिला)।एंड्रॉइड आशय: संलग्नक के साथ एक ईमेल भेजें
क्या मैंने कुछ देखा है? क्या तुम्हारे पास कोई सुझाव है?
private static void email (Context context, String emailTo, String emailCC,
String subject, String emailText, List<String> filePaths)
{
//need to "send multiple" to get more than one attachment
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("text/xml");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[]{emailTo});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailText);
//has to be an ArrayList
ArrayList<Uri> uris = new ArrayList<Uri>();
//convert from paths to Android friendly Parcelable Uri's
for (String file : filePaths)
{
File fileIn = new File(file);
// Uri u = Uri.fromFile(fileIn);
Uri u = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "blabla.xml"));
Log.v("bla", "filepath: " +u.toString());
uris.add(u);
Uri b = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "blabla.es"));
uris.add(b);
Log.v("bla", "filepath: " +b.toString());
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
context.startActivity(emailIntent);
}
LogCat:
03-06 16:08:50.940: INFO/ActivityManager(69): Starting: Intent { act=android.intent.action.SEND_MULTIPLE typ=text/xml cmp=com.android.email/.activity.MessageCompose (has extras) } from pid 436
03-06 16:08:52.130: INFO/ActivityManager(69): Displayed com.android.email/.activity.MessageCompose: +1s118ms
03-06 16:08:52.470: WARN/IInputConnectionWrapper(436): showStatusIcon on inactive InputConnection
स्पष्ट, लेकिन, क्या आप सुनिश्चित हैं कि आपके फ़ाइल पथ सही हैं और वास्तविक फ़ाइलों को इंगित करते हैं? – dymmeh
फ़ाइल पथ सही हैं – user1252642
अधिकांश ईमेल प्रोग्राम 'टेक्स्ट/xml' MIME प्रकारों को संभालने में सक्षम नहीं होंगे। इसके अलावा, अधिकांश उपयोगकर्ता एक्सएमएल नहीं पढ़ सकते हैं। कृपया इसके बजाय 'टेक्स्ट/सादा' या' टेक्स्ट/एचटीएमएल 'ईमेल गद्य का उपयोग करने पर विचार करें। – CommonsWare