Set application label in java code instead in AndroidManifes - android

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.

Related

Modify Android Theme Programmatically

A similar question to this has been asked many times; however, an answer has not been given that addresses my situation. I need to dynamically change an application's theme based on color values that are being returned from an API call. I then need to change the theme colors of the app based on the values returned. Therefore, I have no way of saving the colors in a style XML file. Can this be done?
I have a base activity, and my plan is to set the app theme from there for all the activities.
Unfortunately, I did not find an easy way to do this. I created a ThemeColor class which holds all the colors returned by the API. Then for each activity I have to go through every widget and style it.
Example:
getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(themeColor.getActionBarColor)));
this.getWindow().getDecorView().setBackgroundColor(Color.parseColor(themeColor.getBackgroundColor()));
etc
I was not able to locate a simple way to resolve this issue either. By creating a ThemeColor class that holds all the colors returned from the API. Next for each activity I needed to address each widget separately as well as style it.

CheckedTextView Attributes ID and checkMark

Just start developing with android and think instead of reading a book a webinar could be better because a webinar could also teach me short ways and how an android developer thinks when writing the code but now got a problem
<CheckedTextView
android:id="#android:id/text1"
android:checkMark="?android:attr/listChoiseIndicatorMultiple"
</>
I dont understand the above code up to now see lots of different id definitions some of them was for resources and start with #resource/name, and some of those id definitions was like #+id/name just for creating a new id for the component but this time it is using android:id/text1 and I dont understand why it is using it in that manner
Besides, the checkMark thing make me confuse more what are all those ?android:attr/listChoiseIndicatorMultiple means?
Could you please explain me and show me some resource where can I find all those magic attributes so I can cope next time by myself and hope someday can answer other newbie questions
Thanks a lot in advance, and all comment will be appreciated.
Well, reading the docs has always been helpful to me:
Android Developer Site
XML Layout specific docs
#android:id/text1 is just a format used when the id has been previously defined. When you put a + in there that means the framework should create the resource id if it doesn't already exist.
It's normal to use #+id/thisid when defining a new view in a layout, and then use #id/thisid to reference the aforementioned view from another part of the layout (say, in a RelativeLayout where you need to tell one widget to be below another).
A question mark before the ID indicates that you want to access a style attribute that's defined in a style theme, rather than hard-coding the attribute.
#android:id/text1 basically this is used when you create any android component like button, layout, textviews etc.
but when you need any external component which is general for different platform like any color, image etc then you can declare it as #resource/name.
actually there is nothing different just keep one thing in mind that in #android:id/text1, id will simply work as an class name will contains other objects like textview, imageview or any other.
now if you declare #resource/name then in that also instead of id class name will be resource. actually when you will use it in java then these(#android:id/text1) will be converted into object hierarchy.

Android: programmatically change the application label?

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");

Android How to change the application title

HI
I need to change the application title as when i move to new tab.
i tried to change the app_name with varying string in string.xml but that is not actual dynamic change that i want.
is there any alternative way of doing this?
You can simply call the setTitle() function from within your Activity. It takes either an int (resource ID) or a CharSequence as a parameter.
android:label in AndroidManifest.xml is using reference to #string/app_name for user readable application name (app name in applications list or name under icon on main screen if you add shoutcut)
For changing Activity title you should use setTitle() of Activity class.
then you have to set the custom title for your app. check my post.
You have to set a custom layout for your title. you can access the TextView object from that.
Edit:
Accept Apologize. i didnt read the question propely.
setTitle() method is enough. My answer is about to customizing the title.that is color, text size and all.

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