I'm currently writing an application which acts as a home screen/launcher.
When I'm on the home screen, I still have the back button visible in the navbar. Somehow Google manages to hide it in their Pixel launcher and I've read on GitHub that it's only possible to hide the back button if the application is a launcher (which is the case for my app).
Unfortunately the Android documentation covers only how to completely hide the navigation bar. I doubt that's the way Google went with their Pixel launcher and I suspect that there is some badly documented way of achieving this.
Related
I'm working on an existing Android application for medical purposes.
The back button and home button should be disabled.
With the existing code, the back button is disabled.
For disabling the home button they used onAttachedWindow with LayoutParams TYPE KEYGUARD,
but this security hole is fixed since 4.0.
I tried a lot of similar questions, but none worked out for me.
What is the way to get this done these days?
Also, hiding the status bar on tablet (where the home & back button live) would do the trick,
so any suggestions there are equally helpful!
Update: also, free third party apps that do the hiding trick are okay!
This sounds like a kiosk or dedicated use kinda thing, yes? You want your app to "own" the tablet and prevent other usage? I did this for an app whose sole purpose was to act as a remote control for a custom device. Basically I created two apps, a "custom launcher" app and the app that did the remote control. It's probably possible to integrate the two, but I wanted to support both dedicated and non-dedicated use. Note that I gave the launcher app a password-protected way to access settings so that I could recover the tablet at any time.
You can find a number of tutorials that will guide you through creating a custom launcher, just strip out all the stuff that makes it a generic launcher and replace it with an image button or similar that launches the actual app, or replace the launcher activity with your main app activity. Warning: I never figured out how to remove the launcher except by going into the settings.
As for hiding the system bar (notifications and status icons at the top of the screen), you'll want to use a full-screen theme like #android:style/Theme.NoTitleBar.Fullscreen.
As for hiding the home button I took this approach:
View main_layout = this.findViewById(android.R.id.content).getRootView();
main_layout.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
Unfortunately the STATUS_BAR_HIDDEN flag is deprecated now, but I think some of the other options would have the same effect. Regardless, the best you can achieve within Android's intended use is to temporarily hide the navigation buttons (home and back). A tap on the screen will bring them back.
I'm developing an Android tablet app where I need to show fullscreen content. Entering and closing the app is done using a dedicated physical button on the device. When the button is pressed I want all other traces of the Android UI to disappear, and then reappear when we press the button again. I.e., a fullscreen app that is placed on top everything else.
Any ideas on how to achieve this? I've tried various approaches to no avail:
* Adding SYSTEM_UI_FLAGS* doesn't work for this purpose, as the SystemUI will reappear when touching the screen. Ideally we would also not like the animation when opening our fullscreen app.
* Adding a separate layer on top of what we believe is all other layers, but the SystemUI is still shown
Some kind of layering must be preserved. I.e., I need to show incoming call dialogs on top of the fullscreen app.
Please note: This question is about development in the framework/system part of Android. I'm not looking for answers on how to do it in regular user apps.
I am developing a Launcher app. I need to detect when the user clicks on the menu button so I display several options (a menu). Well, I found out that there are many devices that don't have a menu button so my app cannot display the menu. Searching in other threads I saw that the solution was to have an Action Bar. This can be good for apps but not for my launcher. Anybody has any hint about this?
Well, I found out that there are many devices that don't have a menu button so my app cannot display the menu
More importantly, there will be very few devices with an off-screen MENU button going forward, as Google is being more stringent about this with device manufacturers.
Anybody has any hint about this?
Create your own menu UI, opened by your own ImageButton or whatever.
Or, add the action bar to your activity and use it.
Some games that I play are full screen without the back and home soft buttons. You have to swipe down to get the buttons to show. How do I implement that in an activity? I figured out how to make it fullscreen, but all it does is get rid of the task & notification bar. The nav buttons were still there. I am using several different devices, so if it matters what OS version is needed, I would appreciate that information too.
I am making a live wallpaper for android. I want to implement a function that allow user hide all the icon from the screen of android to show off the live wallpaper(User double click to screen -> hide all the icon). I made everything but I still dont know how to hide all the icons. Anyone know how?
Thank
This is not possible. You cannot attack the home screen, or other apps, in this fashion. A home screen may not even have "icons", depending upon its implementation.
You are welcome to write your own home screen, or perhaps partner with the developers of some replacement home screens, to have this feature implemented by the home screen.
Or, IIRC, there is a way to show a live wallpaper as the background of an activity, though I am not certain of the details. If that is indeed possible, to "show off the live wallpaper", you would offer an activity to do so, one that has nothing in the foreground.