How to launch an Android app without “android.intent.category.LAUNCHER”

前端 未结 4 1107
臣服心动
臣服心动 2020-12-05 21:22

I want to know how to launch an Android app without:

android.intent.category.LAUNCHER

Here is my AndroidManif

4条回答
  •  执念已碎
    2020-12-05 21:50

    I want to know how to launch an Android app without: android.intent.category.LAUNCHER

    In Android, an Activity should be started by an Intent. Intents can start an Activity with startActivity(Intent myIntent), example:

    Intent myIntent= new Intent(context, target_class.class);
                        myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        context.startActivity(myIntent);
    

    You must replace "myIntent", "context" (usually a "this") and the "target_class" with your variables, in order for this to work. So, whenever you need your activity, call the Intent, ans the OS will resolve for the Activity

提交回复
热议问题