Android Question Application icon

agb2008

Member
Licensed User
Longtime User
I've created a simple application with one Activity and notice following issue
when I run in in AVD or on real device - just before switching to FullScreen mode
(I used Activity Attributes: #FullScreen: True and #IncludeTitle: True) I see empty
screen with Title = my application name (defined in "Prject Attributes" #ApplicationLabel)
and... default Android setttings icon... in a second or two screen updated and I see
my main application screen (in fullscreen mode) with proper application icon and Title
defined in Designer -> Activity properties -> Title
Why this is happening ? And how to replace this Android settings icon with my own
icon ? In all other places i.e. icon for my apk file, installed application e.t.c. I could see
my proper icon. I've included only one icon.png file for this application using Project ->
Choose icon
option.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
@agb2008 please see the two sample clips of my app starting and the attached sample program. This is a work in progress, I've been playing with various options and Theme settings for a few weeks trying to understand exactly what influence each setting has. I can sometimes be a bit of a perfectionist and found it highly annoying that on starting my app there was a momentary glimpse of the system ActionBar and App Title before my own which made it look unprofessional :mad:.
This is fixed using the following line in the manifest file, located in the IDE toolbar menu option Project>Manifest Editor...
B4X:
SetActivityAttribute(Main, android:theme, @android:style/Theme.NoTitleBar.Fullscreen)

What I have since been trying to do is load the splash screen with a transparent background that gradually fades out (I've not seen this used on any other App and so it gives a unique feel), but the problem I now have is a very momentary flash of the background behind the Navigation bar (bottom edge of screen) when switching to the next Activity.


(### The unwanted glimpse of the background is more noticeable on the actual device! ###)

For the attached sample program you will need the Appcompat and XmlLayoutBuilder libraries.

Regards,
RandomCoder
 

Attachments

  • Splash Sample.zip
    111.2 KB · Views: 158
Upvote 0

agb2008

Member
Licensed User
Longtime User
warwound, RandomCoder,

Thank you for sharing this information. I did a quick check on Google regarding this option: ".NoTitleBar"
and found that:

1. One suggested alternative to manifest entry in pure Java Android development is setting following attributes in software code:

public class FullScreen extends Activity {
@@override
publicvoid onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.main);
}}


Source of information here: http://www.androidsnippets.com/how-to-make-an-activity-fullscreen

But... when I check java code generated by B4A (main.java file) - looks like these parameters set already
(search for FEATURE_NO_TITLE and FLAG_FULLSCREEN)

2. Just as a guess - could we use following workaround - if we set this NoTitleBar option in Manifest for specific Activity
- then could we create another Activity for which this setting would have no effect and where we for example could create title bar ?

P.S. I've tried to run application in Debug mode and this is what I could see if I set breakpoint at
Layout loading:

---cut---
Switching to real app window: Window{b58ef888 my_test_app.demo.ru/my_test_app.demo.ru.main paused=false}
Switching to real app window: Window{b58ef888 my_test_app.demo.ru/my_test_app.demo.ru.main paused=false}

Displayed my_test_app.demo.ru/.main: +2s133ms
** Activity (main) Create, isFirst = true **
---cut---

Looks like this is where window with Android service icon and Application name in title bar
displayed (not in full screen mode !!!) - but how to find where it's initialized ?

Regards,
agb2008
 
Last edited:
Upvote 0

agb2008

Member
Licensed User
Longtime User
Just small additional note - I tested workaround with two activities - and was able to get "clean" startup of my application:

1. In manifest I set option as you suggested:

SetActivityAttribute(Main, android:theme, @android:style/Theme.NoTitleBar.Fullscreen)

2. For "Main" activity I set as well in Activity Attributes: FullScreen: True, IncludeTitle: False <- not sure if this still needed

3. Add additional activity using Project -> Add New Module -> Activity Module - Give it some other name then "Main" i.e. "Demo"

4. In "Main" activity Activity_create sub add just one statement to start second Activity:

StartActivity(Demo)

5. Create required layout and load it for Activity "Demo"

The only think left would be to define how to handle for example Back Android button - because instead of
interrupting application - it would close Activity "Demo" and switch back to "Main" activity...

For test purpose I used Activity.Finish code in "Main" Activity Activity_Resume Sub... But probably more complicated solution
would be required.

Regards,
agb2008
 
Upvote 0
Top