Custom android launcher goes back to default launcher on pressing back button

I am working on a launcher application. It is being show along with the default launcher on pressing the back button. However, wherever I am in my custom launcher or whether in the starting page of my launcher it self, when I press the back button, the screen navigates back to the default android launcher. I need help. This is the code I used to set my app as a launcher

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.MONKEY" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

thank you in advance


This seemed to work for me
Kotlin

override fun onBackPressed() {}

Java

@Override
public void onBackPressed() {}

Those are categories for intents, Android. Intent. Category. LAUNCHER just means when you run the application it will launch the specified class

链接地址: http://www.djcxy.com/p/19002.html

上一篇: 按内容设置标题

下一篇: 自定义android启动程序在按下后退按钮时返回到默认启动程序