Android Question How Do I Delete the Initial Screen?

spaceman

Member
Licensed User
Longtime User
Hi

When creating a new Basic4Android project, we get an initial screen(Activity).

If we then open the Designer, we're actually esigning a different screen, and not eiting the Initial one that already exists.


This causes the following phenomenon:

When I run my app,
the initial screen is shown for a second,
and only then, the second screen is shown.

I want to get rid of the initial one, because I don't want the user to first see an empty screen, which is then replaced by a secnod one.


How do I do it?


Thank you
 

DonManfred

Expert
Licensed User
Longtime User
In you main/first activity you load a layout in activity_create
Load the right one, not the one you dont want...
 
Upvote 0

spaceman

Member
Licensed User
Longtime User
Hi

I do load the right one.

I only have 1 Layout that I created with the designer.
The other screen is created by B4A...
 
Upvote 0

spaceman

Member
Licensed User
Longtime User
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
End Sub

You see here Layout1 being loaded right?


So when I run the app, I first see the Initial screen(created by B4A, not by me - the one titled as "B4A Example"),
and then 1 scond after it, I see my designed screen("Layout1" - the one I created with the designer).

I am looking to get rid of the initial screen..

It doesn't look professional that 1 screen appears, and after 1 second it's being covered by another one..
 
Upvote 0

spaceman

Member
Licensed User
Longtime User
Hi Erel

Yes the first screen is an empty activity..
I am looking to eliminate it, so the user will not see the empty activity, and then the one I created(Layout1).

Or:
Another solution may be, If I could Edit the main activity with the Designer,
and then I will not have to create a Second one(Layout1)..


Is one of these options possible?
 
Upvote 0

TomA

Active Member
Licensed User
Longtime User
So when I run the app, I first see the Initial screen(created by B4A, not by me - the one titled as "B4A Example"),
and then 1 scond after it, I see my designed screen("Layout1" - the one I created with the designer).

In B4A, with your project loaded, the first line on the screen shows:
#Region Project Attributes
with a "+" in front of it.
Click on the "+" to open the region. Within that you will see the first line showing:
#ApplicationLabel: B4A Example

That is where you initial heading is being shown from. Change that line to your application name and save the project. That should resolve your problem.
 
Upvote 0

spaceman

Member
Licensed User
Longtime User
Hi TomA

Thank you for this workaround - it works very well!

It's interesting:
On the emulator, because the emulator is slow,
you see the first screen being shown(which is completely empty of any controls),
and then after 1-2 seconds you see the second screen - Layout1, with my controls.

The title is the same now,
but it's possible to differentiate betwen the 2 screens, because the first one is empty, and the second is populated.

But when I run this on a real device, now,
you don't see the first (empty) screen,
there's no delay at all, so you immediately see the second screen.


Thank you for this help.


BTW, If I want my app to use a bright theme instead of black,
should I manually edit the Background and Foreground colors, etc,
or is there a way to define that the app uses a bright theme, and all the relevant settings will change accordingly?
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
The effect you see is the starting window which Android adds to a launching app.

The whole subject is discussed very well in this article.

You can remove the starting window in the manifest if you set the android:windowDisablePreview attribute of the activity to true. Though this is not recommended. Read the article then you will know, why.
The way to go is to use a correct theme which better matches the app design.
 
Upvote 0

spaceman

Member
Licensed User
Longtime User
If i remember correctly then you can set the Theme in Manifest.

Right..
I added this line to the manifest:
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light")
and indeed the Theme changed.

Thank you very much.


The effect you see is the starting window which Android adds to a launching app.
The whole subject is discussed very well in this article.
You can remove the starting window in the manifest if you set the android:windowDisablePreview attribute of the activity to true. Though this is not recommended. Read the article then you will know, why.

Wow,
this is definately explaining it well :)

Thank you corwin
 
Upvote 0
Top