I am developing android app in which we take some user information and capture signature and when we click on share button it will store it into database and send an email....but my application is stopping after store operation and does not send a mail....thanks in advance
String TO []= {Email.getText().toString(),"sourabhkabra960@gmail.com"};
File filePath = getFileStreamPath(current); //optional //internal storage
//Intent shareIntent = new Intent();
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
//shareIntent.putExtra(android.content.Intent.EXTRA_EMAIL,TO);
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Name.getText().toString()");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"AmtRec.getText().toString()");
//shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(mypath)); //optional//use this when you want to send an image
shareIntent.setType("image/png");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"));
Bitmap icon = mBitmap;
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
icon.compress(Bitmap.CompressFormat.PNG, 100, bytes);
File f = new File(Environment.getExternalStorageDirectory() + "/" + getResources().getString(R.string.external_dir) + "/" +current);
try {
mypath.createNewFile();
FileOutputStream fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
startActivity(Intent.createChooser(share, "Share Image"));
LOGCAT:
02-04 04:25:49.442: E/MediaStore(1269): Failed to insert image
02-04 04:25:49.442: E/MediaStore(1269): java.io.FileNotFoundException: No such file or directory
02-04 04:25:49.442: E/MediaStore(1269): at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
02-04 04:25:49.442: E/MediaStore(1269): at android.content.ContentProviderProxy.openAssetFile(ContentProviderNative.java:577)
02-04 04:25:49.442: E/MediaStore(1269): at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:673)
02-04 04:25:49.442: E/MediaStore(1269): at android.content.ContentResolver.openOutputStream(ContentResolver.java:537)
02-04 04:25:49.442: E/MediaStore(1269): at android.content.ContentResolver.openOutputStream(ContentResolver.java:513)
02-04 04:25:49.442: E/MediaStore(1269): at android.provider.MediaStore$Images$Media.insertImage(MediaStore.java:891)
02-04 04:25:49.442: E/MediaStore(1269): at com.example.digitalsign.CaptureSignature$signature.save(CaptureSignature.java:437)
02-04 04:25:49.442: E/MediaStore(1269): at com.example.digitalsign.CaptureSignature$2.onClick(CaptureSignature.java:139)
02-04 04:25:49.442: E/MediaStore(1269): at and roid.view.View.performClick(View.java:4240)
02-04 04:25:49.442: E/MediaStore(1269): at android.view.View$PerformClick.run(View.java:17721)
02-04 04:25:49.442: E/MediaStore(1269): at android.os.Handler.handleCallback(Handler.java:730)
02-04 04:25:49.442: E/MediaStore(1269): at android.os.Handler.dispatchMessage(Handler.java:92)
02-04 04:25:49.442: E/MediaStore(1269): at android.os.Looper.loop(Looper.java:137)
02-04 04:25:49.442: E/MediaStore(1269): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-04 04:25:49.442: E/MediaStore(1269): at java.lang.reflect.Method.invokeNative(Native Method)
02-04 04:25:49.442: E/MediaStore(1269): at java.lang.reflect.Method.invoke(Method.java:525)