Is it possible to open up the default Android 开发者_运维百科Messaging activity from inside an activity you write yourself? Like for example: I press a "Mail" button inside my program, and it opens the Android Messaging app just like as if I was to press the Messaging icon on the main screen.
I did something similar to this with the Contacts activity, but only the contact list comes up, no extra functionality like Adding/Modifying/Deleting, etc.
Any ideas?
edit: I found this way to open the "Compose New Message" Activity, I just need to back it up a step. Does anyone know the correct MIME type instead of this one?
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setType("vnd.android-dir/mms-sms");
m_activity.startActivity(sendIntent);
This starts the messaging app from another app:
Intent intent = new Intent("android.intent.action.MAIN");
intent.setComponent(new ComponentName("com.android.mms","com.android.mms.ui.ConversationList"));
startActivity(intent);
Just put it inside a button listener or whatever user input you want to open it from.
Enjoy :-)
If you want to open the messaging app to view messages and not for sending a message, this should do the job:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setPackage("com.google.android.apps.messaging");
startActivity(intent);
精彩评论