Reputation: 367
This Might be a stupid question but please forgive me as I am only a learner.
Is it possible to change the value of player in a method from class if so, please tell me how.
This is part of my R.java
public static final class string {
public static final int player=0x7f060003;
This is part of my string.xml from values file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="player">player</string>
</resources>
Upvotes: 0
Views: 253
Reputation: 11285
No, you cannot change anything in R.java. Don't even try to. You are just asking for a lot of bugs if u do.
If u want to change the title and you are using an ActionBar, you can use the setTitle("String"); method.
Inside the method of a class, u need:
public void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar ab= getActionBar(); //Creates new ActionBar Instance Object
ab.setTitle("Welcome to my App!"); //Sets the title of that ActionBar Object
}
//Method that inflates the ActionBar
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home_action_bar, Menu);
return true;
}
Another way u can change the title is if u put a TextView on top of your layout and change what shows up in the TextView.
Upvotes: 0
Reputation: 10518
No you cant change android application resources in any way. All resources are read only. Maybe you can use SharedPreferences. You can read initial value from resources and then use SharedPreferences to store actual value which you can modify.
Upvotes: 1