Can I disable home button On Android
I found it.
I took a part from here
how to disable home button in android?
and added one row Which originally existed
LAUNCHER row as follow:
<activity android:name=".MainActivity"
android:clearTaskOnLaunch="true"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:stateNotNeeded="true" >
<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.LAUNCHER"/>
</intent-filter>
</activity>
How to disable Home and other system buttons in Android?
First of, please think long and hard if you really want to disable the Home
button or any other button for that matter (e.g. the Back
button), this is not something that should be done (at least most of the times, this is a bad design). I can speak only for myself, but if I downloaded an app that doesn't let me do something like clicking an OS button, the next thing I do is uninstall that app and leave a very bad review. I also believe that your app will not be featured on the App Store.
Now...
Notice that MX Player
is asking permission to draw on top of other applications:
Since you cannot override the Home
button on Android
device (at least no in the latest OS versions). MX Player
draws itself on top of your launcher when you "lock" the app and clicks on the Home
button.
To see an example of that is a bit more simple and straight forward to understand, you can see the Facebook Messenger App.
As I was asked to provide some more info about MX Player Status Bar
and Navigation Bar
"overriding", I'm editing my answer to include these topics too.
First thing first, MX Player is using Immersive Full-Screen Mode (DevBytes Video) on KitKat
.
Android 4.4 (API Level 19) introduces a new SYSTEM_UI_FLAG_IMMERSIVE flag for setSystemUiVisibility() that lets your app go truly "full screen." This flag, when combined with the SYSTEM_UI_FLAG_HIDE_NAVIGATION and SYSTEM_UI_FLAG_FULLSCREEN flags, hides the navigation and status bars and lets your app capture all touch events on the screen.
When immersive full-screen mode is enabled, your activity continues to receive all touch events. The user can reveal the system bars with an inward swipe along the region where the system bars normally appear. This clears the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag (and the SYSTEM_UI_FLAG_FULLSCREEN flag, if applied) so the system bars become visible. This also triggers your View.OnSystemUiVisibilityChangeListener, if set. However, if you'd like the system bars to automatically hide again after a few moments, you can instead use the SYSTEM_UI_FLAG_IMMERSIVE_STICKY flag. Note that the "sticky" version of the flag doesn't trigger any listeners, as system bars temporarily shown in this mode are in a transient state.
Second: Hiding the Status Bar
Third: Hiding the Navigation Bar
Please note that although using immersive full screen is only for KitKat
, hiding the Status Bar
and Navigation Bar
is not only for KitKat
.
I don't have much to say about the 2nd and 3rd, You get the idea I believe, it's a fast read in any case. Just make sure you pay close attention to View.OnSystemUiVisibilityChangeListener.
I added a Gist that explains what I meant, it's not complete and needs some fixing but you'll get the idea. https://gist.github.com/Epsiloni/8303531
Good luck implementing this, and have fun!
Related Topics
How to Implement Autocompletetextview with Listview
Sms Manager Send Mutlipart Message When There Is Less Than 160 Characters
How to Connect SQL Server Using Jtds Driver in Android
Picasso Illegalargumentexception Target Must Not Be Null
Java.Lang.Numberformatexception: Invalid Int: "" in Android
Differencebetween an Intentservice and a Service
When a Fragment Is Replaced and Put in the Back Stack (Or Removed) Does It Stay in Memory
Google Analytics in Android App - Dealing with Multiple Activities
Applying Word Stemming in Searchview for Fetch Data from Firebase Database
Google Play App Description Formatting
What Are the Android Sdk Build-Tools, Platform-Tools and Tools? and Which Version Should Be Used
Allow Multi-Line in Edittext View in Android
How to Make Edittext Not Editable Through Xml in Android
How to Record Video from Background of Application:Android