Sharing text from app to Email app in android

MSM*_*SMC 0 email android share android-intent

I have the following code which used to send text from my app to Email:

Intent mail = new Intent(Intent.ACTION_VIEW);
            mail.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail");
                mail.putExtra(Intent.EXTRA_EMAIL, new String[] {  });
                mail.setData(Uri.parse(""));
                mail.putExtra(Intent.EXTRA_SUBJECT, "Country Decryption");
                mail.setType("plain/text");
                mail.putExtra(Intent.EXTRA_TEXT, "my text");
                ctx.startActivity(mail);  
Run Code Online (Sandbox Code Playgroud)

It works , but as you see, it uses Gmail app, how do I make it use Email application instead of Gmail?

I mean this app: 电子邮件应用程序

and what about sharing to Facebook ? I found that Facebook does not support sharing using intent anymore, and I have to use Facebook SDK, but I couldn't find any simple procedure to do that. Is there any simple way?

Regards.

Max*_*Max 7

使用其他电子邮件应用程序恐怕您必须创建一个选择器对话框并让用户选择要使用的应用程序,就像这样

Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
        "mailto","abc@mail.com", null));
emailIntent.putExtra(Intent.EXTRA_EMAIL, "address");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Body");
startActivity(Intent.createChooser(emailIntent, "Send Email..."));
Run Code Online (Sandbox Code Playgroud)