sexta-feira, 24 de julho de 2015

Android Intent Call Phone and E-mail


Purpose:

[Send e-mail via Android]




a) Import this libraries

import android.content.Intent;
import android.net.Uri;

b)Add this permission on the file AndroidManifest.xml

   

c) Make this code.

    public void SendEmail(EmailTo)
    {
        ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(this);
        builder.setType("message/rfc822");
        builder.addEmailTo(EmailTo);
        builder.setSubject("Subject");
        builder.setHtmlText(getInfo());
        builder.setChooserTitle("Title");
        builder.startChooser();
    }

    public void CallPhone(String Phone)
    {
        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(Phone));
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
    }
Postar um comentário