Hi...
I have developed a application which can send an email with one image
attachment.
Now i want to attach the multiple images.when i click a button email
should send to a hard coded email address with multiple image
attachments.
I used intents for my program. To send image i used putExtra
method and send image as a EXTRA_STREAM.
Are their any way to implement this.If any body knows plz help me
my code is
public class emailFun extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.email_main);
Button btnSend = (Button) findViewById(R.id.mbutton);
btnSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (v.getId() == R.id.mbutton) {
sendEmail();
}
}
});
}
public void sendEmail() {
String []mailto = {"[email protected]"};
// Create a new Intent to send messages
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
Uri _uri=MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
android.provider.MediaStore.Images.ImageColumns.DATA },null,
null,
null);
Cursor cursor = getContentResolver().query(_uri, new
String[]
{ android.provider.MediaStore.Images.ImageColumns.DATA },null, null,
null);
cursor.moveToFirst();
int i=cursor.getCount();
sendIntent.putExtra(Intent.EXTRA_SUBJECT,"Accsident
pictueres-
count"+i);
cursor.moveToFirst();
String imageFilePath1 = cursor.getString(0);
String modPath1="file://"+imageFilePath1;
Uri uPath1=Uri.parse(modPath1);
sendIntent.setType("image/jpg");
sendIntent.putExtra(Intent.EXTRA_STREAM,uPath1);
startActivity(Intent.createChooser(sendIntent,"send the
mail"));
cursor.close();
finish();
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---