浏览手机注册的帐户

时间:2011-06-10 05:17:42

标签: android

我想要而不是在我的应用上手动输入电子邮件,我将在应用上打开已注册的电子邮件(设备帐户)。 我在另一个应用程序上看过一次。 如何实现这一目标?

谢谢!

2 个答案:

答案 0 :(得分:2)

我想,我可能错误地理解了这个问题,你需要

    Account[] accounts = AccountManager.get(this).getAccounts();  
    for (Account account : accounts) {   
    // TODO: Check possibleEmail against an email regex or treat 
  //account.name as an email address only for certain account.type values.  
     String possibleEmail = account.name;
       ... 
    } 

答案 1 :(得分:0)

启动意图:

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

String aEmailList[] = { "user@fakehost.com","user2@fakehost.com" };
String aEmailCCList[] = { "user3@fakehost.com","user4@fakehost.com"};
String aEmailBCCList[] = { "user5@fakehost.com" };

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(android.content.Intent.EXTRA_CC, aEmailCCList);
emailIntent.putExtra(android.content.Intent.EXTRA_BCC, aEmailBCCList);

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

emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My message body.");

startActivity(emailIntent);