Android: programmatically change the application label? - android

It doesn't seem possible, but I was hoping someone may be aware of a way. Can the label of the application (the one defined in the manifest file by android:label="#string/app_name") be set from code?

That is read-only, AFAIK.
If your objective is to change the title bar of your activities, you can call setTitle().

I mostly use this to change actionBar's text pragmatically in onCreate() method....very easy!
getSupportActionBar().setTitle("yourString");

I used:
this.setTitle("YourString");

Related

Android, change button style at runtime

I need to change button style from "contained" to "outlined" at runtime.
For now the only way I've found to create an outlined button is to set its style to ?attr/materialButtonOutlinedStyle.
Unfortunately I haven't found a way to change the style at runtime, is it possible?
Is there any way to get this effect?
As a view with text inside, it should have "setTextAppearance" function. It's not the ideal option but may help. Also can be useful to look on https://github.com/airbnb/paris.

Dynamically Updating Launcher Icon in Android

I am trying to put a dynamic value in the launcher icon of android, as number of messages will be displayed in the message icon. As the icon is static and initialised before the application starts, Is there any way to achieve this??
For Android Launcher Icon you can't. It is impossible. (Or by Making your own launcher) The only one thing is you have to make a Android-Widget for this purpose. Which looks like a application icon. But it will act as a widget.
Also Make a dynamic launcher icon
simple answer is you can't do it also this question says the same. But there may be advance tricky methods/ways that I'm not aware of.
But you may try and develop widgets that changes dynamically.
You have to design your icon as a selector instead of drawable. Have a look at this.
You cant update because its related to manifest.xml stuff only possible with software upgrade.

Set tab indicator in XML

Is it possible to set tab's indicator not in code behind (by using setIndicator), but in XML?
No, sorry, you can only define tabs (whether TabHost or the action bar) in Java.
No, AFAIK there is no way to set in layout xml. If you want those values dynamic, you may add them in separate xml and parse in program and set.
no,It is not possible
But still check it outTabs tutorial

Set application label in java code instead in AndroidManifes

Is it possible to set label for application in java code instead in AndroidManifes, I mean the displayable name of application not just title of activity.
I don't think you can, as per the answer to this related question.

Android easy switch color-scheme of application

How would you implement different color themes in your app?
All I can see now is plain set color onCreate every activity and control...
Also, how would you store different color schemes in xml?
Just an entries of with different names?
Thank you!
Use custom Themes, which are declared in XML. They are very similar to CSS, if you've used them before.
EDIT:
Here's a better example of changing the theme at run time

Categories

Resources