Android Question How to hide initial/default activity until layout loads

JohnC

Expert
Licensed User
Longtime User
When my app first starts, an activity with the Titlebar showing my app's name and a black body is very briefly displayed, then the layout I am loading in the Activity_Create is displayed.

How can I prevent this unknown initial/default activity from displaying before my actual desired layout is loaded?

I even have the below in the "Main" activity:
B4X:
#Region  Activity Attributes
    #FullScreen: false
    #IncludeTitle: False
#End Region
 

moster67

Expert
Licensed User
Longtime User
I've seen this as well and it has been discussed on numerous occasions here in the forum. Lately I have been developing with Android Studio and I cannot recall seeing this.

One thing you could try is to use the XMLLayoutBuilder library and see if you note any improvements.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1) Because my app doesn't have a titlebar/actionbar, then 4.0+ devices that don't have a dedicated menu button will have nowhere to put the menu/overflow 3-dot menu icon, so it wont appear anywhere in my app - is this right?

2) Accordingly, then it's my responsibility to put the 3-dot icon in the top right corner of my app (in the AppCompat toolbar) and display the app's menu programmically using "Activity.OpenMenu" when the user clicks it. Is this right?

The three dots will appear automatically:

upload_2016-7-15_8-7-47.png


Just remove the inline java code that was added in the example.

The complete code to test it:
B4X:
#Extends: android.support.v7.app.AppCompatActivity

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

Sub Process_Globals

End Sub

Sub Globals

End Sub


Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("layout1")
   Activity.AddMenuItem("Test1", "test")
   Activity.AddMenuItem("Test2", "test")
End Sub

Sub test_click
   Log("click")
End Sub
 
Upvote 0
Top