开发者

how to put action to open applications on Grid icon menu

开发者 https://www.devze.com 2023-01-08 08:17 出处:网络
I have designed a main menu in android, but now I have no idea how to open that application when I click some specific icon for that application.

I have designed a main menu in android, but now I have no idea how to open that application when I click some specific icon for that application.

Any help or hint will be appreciateable.

开发者_如何学C

Thanks alot.


You need to know the package and class names:

public static Intent getLaunchIntent(String packageName, String className) {
    Intent intent = new Intent(ACTION_MAIN);
    intent.addCategory(CATEGORY_LAUNCHER);
    intent.setClassName(packageName, className);
    intent.setFlags(FLAG_ACTIVITY_NEW_TASK
            | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
    return intent;
}
0

精彩评论

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

关注公众号