开发者

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;
                }
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜