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.
Related
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.
I have a WordPress theme that switches to the toggle menu in mobile. However, when you try to use it on a phone it disappears before you can click on a link. The menu is long enough that it doesn't show unless you scroll down. Touching the screen to scroll down results in the menu closing.
If I size the browser down to mobile and use my computer's touchscreen, the menu opens and works perfectly, allowing me to scroll then choose my link. But on both an Android phone and an iPhone, it closes too quickly.
I tried using a menu plugin to bypass the theme menu, but ended up with two toggle menus in the header.
So. Can I either fix the theme's menu button (ideal solution) or find a way to bypass it without killing the rest of the navigation and use a plugin?
The site is http:/www.pmi-global.net.
Thank you.
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.
In my app, there is a activity where it is important that the system UI buttons (home, back, etc.) are not pressed, though it is ok if they are still visible. I have heard that there might be a way to achieve this, at least in 4.0 (I'm using 4.2).
A way to quickly and automatically return to the app if the buttons are pressed is also a correct answer, but seems less plausible. Thanks.
This is possible to override the home button by making your activity as home activity i.e
-- category android:name="android.intent.category.HOME"
but in this case android give user option to choose the app on launcher dialog where if user choose your application and click always, he will not be able to go to homescreen until you specifically provide a exit button oinside your app and reset it which you should definately do.
In the past I've kept my game's options behind the physical menu button for these reasons:
I don't have to have on-screen buttons in-game.
The menu action is consistent with the android user experience; it's not something unique to my app.
In some situations Android provides a soft menu button in the bottom system bar. Looking forward, though (e.g. with recent devices and targetSdkVersions), it seems there's no guaranteed way to have a menu button without implementing the new ActionBar.
If my understanding is correct, I see these options:
Use the ActionBar. Say goodbye to a big chunk of screen real-estate, especially in landscape orientation.
Implement my own on-screen menu button. I've seen this in other games, and it strikes me as inconsistent and terrible.
Target an old sdk version. I don't like this.
Is my understanding correct? Anyone have additional suggestions for my list?
relevant links:
http://developer.android.com/design/patterns/compatibility.html
Android Menu Button on 4.0 Devices
Android 3.0 statusbar & targetSdkVersion in manifest, menu button
android honeycomb menu button target
You could implement a tiny , transparent menu button of your own. Many games do that. That way you are not dependent on anyone and you don't loose any screen space.
Edit : Your menu button could then have follow your game's design.
Is my understanding correct?
Yes.
Anyone have additional suggestions for my list?
Your definition of "terrible" differs from mine. IMHO, any game that has its own stylized graphics and look (i.e., just about anything using the Canvas or OpenGL) should have implemented its own "menu" from the outset, and therefore largely would be oblivious to these changes.