My application is running landscape mode and I have set the following property of activity in manifest file
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen"
It surely hides the notification bar when my activity is running. But when for suppose I launch browser activity from my app and returns, the notification bar is visible again. I am trying to find its solution nothing is working. I followed the following link but in vain.
Hidden notification bar reappearing after screen lock and unlock
Any idea?
I handle these things in my java code
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
The nice part of handling this in java is you can release those flags at any time to get rid of full screen. I put this before setContent but I can't recall if that it required or not.
If this doesn't keep it fullscreen you could try to put it in the onResume(), which is my guess how your losing it.
Related
I've been trying to lock the navigation bar on Android for 3 weeks so that the user can't send my activity to background. I need to do this to get my lock screen app more secure (I know that writing a custom lock screen is not the best idea but it's a requirement).
I've tried immersive mode, system dialogs, flags on decor view, onKeyDown, onBackPressed (this one works for the back button), reorder_tasks and moving my task to the front (this only works when I click on recent apps) and the usage API.
I've found this app: https://play.google.com/store/apps/details?id=com.wow.keypad.lock.screen which does EXACTLY what I need to do but I don't know how they did it.
Could anyone please help me?
I need a permanent solution like the one these guys from WOW have done.
Thanks!!!
How To Hide Navigation Bar Permanently In Android Activity
It looks like something like this has already been tackled. Your main task would not be to lock the nav bar, as much as just hide it so that the user cannot access it.
I am working on a complex Android app and found a strange problem.
The problem occurs when I start an activity to show a dialog.
What have I tried
I tried to search for similar problems ("Android activity blocked by home activity" etc) but could not find any.
Due to the complex nature of my app, I still cannot find the minimum representation of the cause -- The Description section below cannot be used to reproduce the problem. It is just something that I think is closely related to the problem. The real cause could be interactions between different subsystems.
Description
The activity is launched by a service with intent flags = FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TOP, which ensures that it will be the topmost activity at the point when it's launched. In its onCreate method, the activity set its window flags to be FLAG_SHOW_WHEN_LOCKED | FLAG_FULLSCREEN | FLAG_TURN_SCREEN_ON | FLAG_DISMISS_KEYGUARD, which ensures that even if the screen is locked, the activity will still be displayed. The dialog is also built and shown in the activity's onCreate method.
The app is tested on Android phones with screen pattern locks using the following steps:
Start the app. Press home button to return to the home activity. Remove the app from the recent app list.
Turn off and lock the screen by pressing the power button.
Ask (through GCM, to be specific) the service to launch the activity once. Dialog is then successfully shown.
Don't click any button on the dialog. Lock the screen again.
Ask the service to launch the activity once more. This time the dialog is also shown but instantly disappears, leaving the screen pattern lock shown.
Unlock the pattern lock and something strange appears: The dialog is now shown behind the home activity. The dialog doesn't respond to touch event. It's just like a wallpaper.
Android Version seems to matter
The problem seems to be only affecting some of the versions. It occurred on a Galaxy Nexus (Android 4.4.2) but didn't occur on a Galaxy Tab 3 (Android 4.1).
Accidentally the problem was solved by removing the line
android:theme="#android:style/Theme.Dialog"
for the activity containing the dialog from AndroidManifest.xml.
I am not sure why it could be solved in this way though.
Hello,
I need do fullscreen in android 4.0 (I must hide back button, home...)
I used android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
but it doesn't work.
Homebutton and backbutton cannot be hidden...
Users always need to have access to these buttons, so the black bar will always be on the screen
Like write K_Anas in a relative question, it is not possible hide Homebutton and backbutton in Android 4.0, for security reasons and because is a simply anti-pattern solution.
You can use SYSTEM_UI_FLAG_HIDE_NAVIGATION to hide the system navigation temporarily, but it will always reappear when the user touches the screen. Even the notification bar will reappear when the screen is touched.
You are not allowed to hide the system bar with the home button completely for security reasons.
I am developing a magazine reader application aimed at the Kindle Fire. In landscape mode the built in softkey bar and status bar in the Kindle's operating system leave little room for my content so I have opted to run the activity in fullscreen mode using the following theme for the activity:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
This works fine, the status bar is hidden and the softbar is minimized like so:
I can bring up the menu bar by dragging it up like so:
The bug arises when I then click somewhere on screen to dismiss the softkey bar. The bottom bar slides back away, the top one does too but the space that it took up becomes a black void and my app is pushed down underneath it so my tab bar at the bottom of the app is now unusable:
I am using a tabhost activity here and the tab I am on in these screenshots is the actual reader section of the app. This subactivity uses a PDF viewer widget which is written using native code and this bug only happens on this tab. If I switch to one of the other tabs which contain no JNI code this bug does not happen so I'm pretty sure its the combination of the Kindle Fire OS, the fullscreen activity and the use of JNI code.
Has anyone else experience this issue?
Any help much appreciated!
Thanks
There are a couple of fullscreen modes for the Fire (at least the new ICS based ones) - check out https://developer.amazon.com/sdk/fire/cx-guidelines.html#Fullscreen for the options. I suspect the ICS Full Screen mode will be what you need
Also it's probably worth trapping the onOrientationChanged and onSizeChanged events to make sure you re-draw the screen correctly when the menu/toolbars appear and disappear per the screen layout sample at https://developer.amazon.com/sdk/fire/samples.html
In my application, I have set it up in the XML so it is in full screen using
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
Now this works fine when the app opens, however if while using the app, I use the home button to back out of the app, and then open it again, when it opens, a black navigation bar will appear for a second or two before disappearing. This does not occur if I exit the app using the back button, just the home button.
Does anyone know why this happens? I have tried doing it from code instead using
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
However, what this does is removes the title bar, but the black bar is there at the top, just nothing is in it.
I.e. this bar
I tried combining the code, by putting the full screen line of code in the XML and also adding the code I showed above into the app, but same thing happens. If I back out of the app with home button and enter it again, that black bar will appear for two seconds temporarily pushing the app and its contents down before righting itself again.
How do I go about fixing this? I have been trying loads of different solutions, but nothing seems to work.
Thanks in advance
Seems to a bug with Android OS. Only way to fix it is go to device, settings animation, and disable animations.
try to remove animation by setting->brightness->animation
set no animation there