0

Here is my code It does sends the mail but without any Image as attachment

 EditText eto=(EditText)findViewById(R.id.etxtTo);
 EditText esub=(EditText)findViewById(R.id.etxtSubject);

 String to=eto.getText().toString();
 String sub=esub.getText().toString();

 Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
 emailIntent.setType("application/image");
 //emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 //String filePath = ImageDetailActivity.this.getResources().getAssets()+"/"+file;
 //Log.d("file address",filePath);
 //Log.d("file address method2","file:///android_assets/"+file);
 File ff=new File(filePath);
 pngUri=Uri.fromFile(new File("file:///android_assets/"+file));
 emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
 emailIntent.putExtra(Intent.EXTRA_SUBJECT, sub);

 emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,Uri.parse("file:///android_assets/"+file));
 startActivity(Intent.createChooser(emailIntent, "Choose an Email client :"));

The problem here is I am not able to receive Images attached with the mail. I have tried a lot of method serching for the solution but not able to figure out the problem

Rajnish Mishra
  • 826
  • 5
  • 21

0 Answers0