How to open the default mail inbox from android code?

前端 未结 9 1675
执念已碎
执念已碎 2021-02-19 00:43

I\'m trying to link a button to the mail app. Not to send mail, but just to open the inbox.

Should I do this with Intent intent = new Intent(...)?

9条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-19 00:46

    To open it new task use the below code:

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_APP_EMAIL);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
    

提交回复
热议问题