Email vis Intent : Email « Network « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Network » Email 




Email vis Intent
 


package app.test;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Intent emailIntent=new Intent(Intent.ACTION_SEND);

        String subject = "Hi!";
        String body "hello from android....";

        String[] extra = new String[]{"aaa@bbb.com"};
        emailIntent.putExtra(Intent.EXTRA_EMAIL, extra);

        emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
        emailIntent.putExtra(Intent.EXTRA_TEXT, body);
        emailIntent.setType("message/rfc822");

        startActivity(emailIntent);
    }
}

//main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
</LinearLayout>

   
  














Related examples in the same category
1.Builds a list of the recipients email addresses each on a different line
2.Is string an Email address
3.Send email
4.isValidEmailAddress: Check the email address is Valid
5.Launch the email intent
6.start Email Intent
7.start Html Email Intent
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.