Process ID of an Activity in android?
Can i get the process Id of an messaging activity? and also using this can i start that partic开发者_开发问答ular activity.
You must be looking for Messaging Intent not process id.
Eg: startActivity(com.android.mms)
One solution that isn't pretty is to use Activity manager and go through all the Running app processes searching for that messaging app.
ActivityManager manager = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> processes = manager
.getRunningAppProcesses();
for (RunningAppProcessInfo process : processes) {
String name = process.processName;
if (name.contains(MESSAGING_APP_NAME) {
return process.pid;
}
}
精彩评论