2012-04-20 59 views

回答

1

我認爲這對於打開電子郵件應用程序很有用。

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 

String[] recipients = new String[]{"[email protected]", "",}; 

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipients); 

emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test"); 

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "This is email's message"); 

emailIntent.setType("text/plain"); 

startActivity(Intent.createChooser(emailIntent, "Send mail...")); 
+0

我的平板電腦上的包是不同的: 'mailClient.setClassName( 「com.sec.android.app.latin.launcher.email」,「com.sec.android.app.latin.launcher.email.Launcher」);' – Gustavo 2012-04-23 13:39:59

0
以下意圖到Android設備上啓動電子郵件應用程序

使用正在尋找:

Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email"); 
startActivity(intent); 
2

您可以通過意向

Intent intent = new Intent(Intent.ACTION_SEND); 
intent.setType("plain/text"); 
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" }); 
intent.putExtra(Intent.EXTRA_SUBJECT, "YOUR SUBJECT"); 
intent.putExtra(Intent.EXTRA_TEXT, "YOUR MAIL BODY"); 
startActivity(Intent.createChooser(intent, "")); 
+0

我試圖打開「電子郵件」應用程序而不是一些電子郵件應用程序= D – Gustavo 2012-04-20 23:06:28

+1

我認爲這個問題是問如何打開應用程序(查看收件箱) – 2012-09-05 15:25:24

2

既然你需要啓動一個包,這應該是解決方案,您開始:

Intent mailClient = new Intent(Intent.ACTION_VIEW); 
mailClient.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity"); 
mailClient.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
context.startActivity(mailClient); 
相關問題