Android Question B4A Full Screen set in code and designer but bottom bar show?

ronovar

Active Member
Licensed User
Longtime User
Hi..here im attaching a screenshoot on my android device that have on bottom line and i don't know how to hide it...i use this code at the begining of b4a project file.

#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region

And this is what i get...does have idea how to have app full screen without botton grey line?
 

Attachments

  • 20150105_145350.jpg
    20150105_145350.jpg
    129.7 KB · Views: 415

ronovar

Active Member
Licensed User
Longtime User
Thanks Erel....is there code that hides bottom bar..because i have one Android Box with Android 4.1.2 and other with Android 4.4.2...on 4.4.2 bottom bar dissapers...but on 4.1.2 i im unable to hide bottom bar.

I try using Reflector library but bottom bar or 4.1.2 is shown.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")

    Dim r As Reflector
    r.Target=Activity
    r.RunMethod2("setSystemUiVisibility", 8, "java.lang.int")
End Sub

And i have one more question...i have SRT subtitles module that displays text from SRT on LABEL1...so i need code that sets automatically background of LABEL1 gray from automatically calculated width and height of LABEL1. I found Your code here on forum someday....but i can't find it anymore...so if You can please poste it here.

I Found i need to use this flag so that bottom bar is hidden but i don't know how to write syntax fot Reflection.

SYSTEM_UI_FLAG_LOW_PROFILE
 
Last edited:
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
Here is code taken from this forum..that hides bottom bar but it hidden when the Include Title is True...when set to False it is not hidden....the bottom bar is shown.

So my question is: How to hide bottombar using this code when IncludeTitle is set to False?

Here is zip project code.
 

Attachments

  • HiddenBotomBar.zip
    7.7 KB · Views: 283
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I Found the solution...and is working perfectly. So You need to set this:

B4X:
#Region  Activity Attributes 
    #FullScreen: True
    #IncludeTitle: False
#End Region

And in code add this under activity_create

B4X:
'HIDE Bottom Bar
    oldActivityHeight = Activity.Height
    l = GetDeviceLayoutValues

    If p.SdkVersion >= 16 Then
        r.Target = r.GetActivity
        r.Target = r.RunMethod("getWindow")
        r.RunMethod4("setFlags", Array As Object(FLAG_FULLSCREEN, FLAG_FULLSCREEN), Array As String("java.lang.int", "java.lang.int"))
        Activity.Height = l.Height+8%y
        DoEvents
    End If

And Top and Bottom Bar is completly hidden under Android 4.1.2....so the idea was when showing grey bottom bar like on first screen shoot above is to expand height of bottom bar to down...to hide it..on FULL HD monitor it is 8%y...i im not experimenting what it is on 720p...but playing with values up or down you will get desired results.
 
Upvote 0

mbatgr

Active Member
Licensed User
Longtime User
You need in B4A under Project-Manifest Editor You need to add android:targetSdkVersion="16" then it will hide on all versions.

I tried it but nothing happens... Could you please tell me more specification of your working environment eg. java version, version of B4A compilation etc. I wonder what I make wrong...
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I im running B4A... and android version 4.2.2.... post your code here as zip project so that i can see code and see where is syntax error....and what version of android you are using?
 
Upvote 0

padvou

Active Member
Licensed User
Longtime User
I Found the solution...and is working perfectly. So You need to set this:

B4X:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

And in code add this under activity_create

B4X:
'HIDE Bottom Bar
    oldActivityHeight = Activity.Height
    l = GetDeviceLayoutValues

    If p.SdkVersion >= 16 Then
        r.Target = r.GetActivity
        r.Target = r.RunMethod("getWindow")
        r.RunMethod4("setFlags", Array As Object(FLAG_FULLSCREEN, FLAG_FULLSCREEN), Array As String("java.lang.int", "java.lang.int"))
        Activity.Height = l.Height+8%y
        DoEvents
    End If

And Top and Bottom Bar is completly hidden under Android 4.1.2....so the idea was when showing grey bottom bar like on first screen shoot above is to expand height of bottom bar to down...to hide it..on FULL HD monitor it is 8%y...i im not experimenting what it is on 720p...but playing with values up or down you will get desired results.

Hi,
I'm getting this error during compile:
B4X:
B4A version: 5.80
Parsing code.    Error
Error parsing program.
Error description: Undeclared variable 'flag_fullscreen' is used before it was assigned any value.
Occurred on line: 250 (Main)
        r.RunMethod4("setFlags", Array As Object(FLAG_FULLSCREEN, FLAG_FULLSCREEN), Array As String("java.lang.int", "java.lang.int"))
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
You need to define FLAG_FULLSCREEN as int, i think its value is 1...check android developers guide of what value is FLAG_FULLSCREEN
 
Upvote 0
Top