Method that makes action bar comes up again when hidden - android

I'm devolopping a tablet app. I want it to work full screen. After days of investigeting on google, I achived it using:
.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
.getWindow().getDecorView().setSystemUiVisibility(Window.FEATURE_ACTION_BAR_OVERLAY);
.getWindow().getDecorView().setSystemUiVisibility(Window.FEATURE_ACTION_MODE_OVERLAY);
The Tablet I'm using is 4.1 Android version. That was working perfectly though I had to made some changes like doing my own action bar (because sistem action bar made navigation buttons comes up) and dialogs.
Now the problem is that I've installed my application on 4.2 Android version and it's a disaster. Each time I touch the screen, navigation buttons comes up. It's really annoying. This is driving me mad, I've tried many things but it's still coming up.
Is there a way to solve this problem? I think if I could override the method that makes navigation buttons comes up I could achieve my objective. Anybody know which is this method??
It is not working in 4.0 Android version neither. That doesn't bother me much, but if you know a way to solve it as well, that would help me a lot.
I would appreciate any help. Thanxs a lot.

Each time I touch the screen, navigation buttons comes up.
One of the core Android concepts is that the user is always in control of the UI. If developers were allowed to create fullscreen Apps and override the navigation buttons, it would be trivial for an App (rogue or otherwise) to create a screen which the user could not get out from.
If you really want to remove the system bar, you will system-level access or you need to build your own custom Android.

Related

Disabling home button Android

I have read a lot about how we cannot override or disable home button. And I too agree that its risky in many ways as some people might take wrong advantage of it. But unfortunately its a requirement in my app.
I was able to hide them in my device which runs on Android Kitkat using the Immersive feature. Its true that when user swipes from the edge of the screen it makes the status and navigation bar visible. But I found out a way to disappear it again by calling Immersive every second or so using CountDownTimer. The result was satisfactory and got the job done.
But I do not have any solution for Android devices which does not run on Kitkat as the bars appear every time we interact with screen. Even though the bars hide but appearing every time the user touches the screen does not look good. So Immersive feature is out of question since it does not run except for Kitkat.
I did try out another solution suggested in various SO posts -
Making my activity visible when the screen is locked. This helped me to get rid of the third button (button right side of Home button, not sure what it is called). And we could easily handle back button. But still home button is remaining. I need to somehow make this Home button disable or do nothing. Or atleast (worst case scenario) navigate to my app when ever I click on home button (Is it possible?)
What I am looking for is the user should only be able to leave the app from a button which I have provided in my app, there should'nt be any other way. Can someone suggest me a way to achieve this?
I am on a deadline here. Any help on this will be helpful to me greately. I am also open for other ways of achieving the above nonesense feature.
Thanks :)
Android 5.0 introduces a new screen pinning API that lets you temporarily restrict users from leaving your task or being interrupted by notifications. Once your app activates screen pinning, users cannot see notifications, access other apps, or return to the home screen, until your app exits the mode.
https://developer.android.com/about/versions/android-5.0.html
I was interested on this subject, and a topic discussing the same was release weeks ago. the conclusion is on older versions exists external librarys and/or simple code to implement and override home button.
On +4.0 i dont think so. check this topics: Disable Home button in Android 4.0+ and https://stackoverflow.com/a/10025904/3640637
hope it helps.
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
Add this to your activity in the manifest.
I think would be better for you to change your approach. If you want to make something which never will be closed by Home button, just make service and add a view to the Window Manager. With the Layout params you will be able to draw on top of everything that even home button won't close it. Life sample could be Facebook messengers new chat.
You can make 2 services. One to cover status bar layer and another one to cover the other part of the screen. Please have a look at this samples
Overlay Status bar on android 4.2.2+
http://www.piwai.info/chatheads-basics/
I have tried to block Home button with the sample below, but this blocks only HARD home button
- https://github.com/shaobin0604/Android-HomeKey-Locker
Your explanation helps only for the newer versions. So just combine or take the first one to achieve that. Good Luck :)
If people here have some other good approach, then I would like to hear that, because it is interesting for me.

Android 4.4.2 Accessibility Explore By Touch not working in app

I'm writing an app that behaves normally in Android 4.3 but does not in 4.4.2. The issue is that with Accessibility "Talk Back" feature turned on you should be able to explore by touch over the buttons of your app and have it announce the contentDescription.
This works fine in 4.3 but in 4.4.2 only the navigation drawer and items on it announce themselves. The rest of the app is all buttons and a fragment on the main activity.
I should point out that the main activity uses TextToSpeech, I'm worried there is a new conflict here.
Has anyone else seen this problem? Any suggestions on a solution?
Thanks, Chuck Brandt
Is the content that is not being spoken in a WebView? Is the navigation drawer implemented via a DrawerLayout from the support library? If the latter is true, is the content announced when the navigation drawer is hidden (i.e. drawer closed)?
I have fixed this issue. It seems to be related to the fact that I had a group of buttons on a fragment, I moved them into the activity. I also had (temporarily) android:importantForAccessibility="noHideDescendants" in the outer LinearLayout, I removed it. I was probably trying all settings of that flag and that is the last one I used. Like I say, not sure which one was most important to getting it to work, but it is working now. Thank you for all your help. Chuck

How to create a screen without a system bar at the bottom in android emulator?

I would like to test my app in android 4.2.2,I know certain device comes with system bar along screen and others don't.I would like to know how to test those system bar that doesn't come along screen.Please provide your assistance in fixing the emulator for this,thanks a lot.
This is an old good question. If changing theme does not fits your needs, please refer to these question asked before:
Easy way to hide system bar on Android ICS
Is there a way to hide the system bar in Android 3.0? It's an internal device and I'm managing navigation
is it possible to hide the system bar
and others.
Note that for some HW Devices/Android version, the system bar can't be hidden at all! You need to root the device and manage some complex operation to get the system bar off...
Good luck!
You can change the theme of the Project from manifest file..it will solve your problem

Is there a way to move the android Honeycomb action bar?

I like how the Android 3.0+ action bar looks, but I don't want it to be on top of the screen. Is there a way to move it to the bottom or to the side?
It is not possible to do so. At least not using public APIs. You could easily find a way to do it but your app would be inconsistent with other apps and likely to break with future updates of the OS.
I think you may have some luck if you delve deep enough into ActionBarSherlock's source code. Since that library creates an ActionBar for pre-HC devices, you may be able to just change the position where it appears. This isn't exactly the answer you were looking for, but it just might be able to solve your problem.

Is there an Android Tablet equivalent of UIPopOverController?

I'm just mucking around with Android tablet stuff in 3.0. I have fragments set up to do the equivalent of UISplitViewController for iPad. Anyone know what the best solution to get something like the iPad UIPopOverController is?
I'm thinking the options are either a separate dialog or something in the Action Bar ...?
I haven't actually seen any Android tablets running 3.0 so not clear what the standard will be ...
Many thanks in advance
This may not be exactly what you are looking for because I'm not all that familiar with UIPopOverController but I think you can accomplish something similar using a Toast with a customized layout.
I would take a look at Creating Toast Notifications and see if it works for you.
Depending on the functionality needed it might work, otherwise you might need to look into trying to generate a modeless dialog with a custom layout.
As for your other question, yes options are generally stored in a separate activity within your application and following Honeycomb design the options activity would be accessible from the Action Bar and the options itself could be a fragment.
Its nothing official but I would crack open the source code to the contacts app for 2.0+ They emulate the popover UI using an Activity in a pretty creative way. It might be a little over kill as it was designed to be usable by any application not just itself. But it should help give you a nudge in the right direction.
Also depending on what the behavior you are looking for exactly a combination of fragments and action bar could be the way to go, but its not going to be as easy as iOS.

Categories

Resources