2017-11-03 7 views
1

デバイスのメールを開いて、アンドロイドの新しいアップデートの電子メールを送信するには、次のコードを使用してtext/message/html/plainをサポートするアプリケーションのリストを表示します。これは、それが働いたあなたの問題を解決することがあり、プログラムでのメールアプリを開くcode.Hopeを次使用するコードを以下の多くの検索後電子メールアプリケーションをプログラムでアンドロイドで新規アップデート

try { 
    Intent intent = new Intent(Intent.ACTION_SENDTO); 
    intent.setData(Uri.parse("mailto:")); // only email apps should handle this 
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"example.yahoo.com"}); 
    intent.putExtra(Intent.EXTRA_SUBJECT, "App feedback"); 
    startActivity(intent); 
} catch (android.content.ActivityNotFoundException ex) { 
    ToastUtil.showShortToast(getActivity(), "There are no email client installed on your device."); 
} 

答えて

0

を私が発見した:

Intent intent = new Intent(Intent.ACTION_SEND); 
    intent.setType("text/plain"); 
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{context.getString("email_to")}); 
    intent.putExtra(Intent.EXTRA_SUBJECT, context.getString("email_subject")); 
    context.startActivity(Intent.createChooser(intent, context.getString("email_body"))); 
1

この意図は、mailtoのウリで電子メールクライアントのために動作します私のために。

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("mailto:"+"email_to")); 
     intent.putExtra(Intent.EXTRA_SUBJECT, "email_subject"); 
     intent.putExtra(Intent.EXTRA_TEXT, "email_body"); 
     startActivity(intent); 
+0

これは素晴らしい解決策でもあります。 –

+0

よくThxが答えを受け入れます。 – ADM

関連する問題