Reputation:
<item
android:id="@+id/menu_selectDate"
android:orderInCategory="100"
android:showAsAction="ifRoom|withText"
android:title="@string/date"/>
I need this title to be variable to the selected date
Upvotes: 1
Views: 747
Reputation: 61
Leave the string name field empty in your layout. then in your activity write the following:
menu_selectDate.setText(YourDate);
Upvotes: 0
Reputation: 7092
try this way
String res_date = Context.getResources().getString (R.string.date)
Please see the android developer guide this link
Upvotes: 0
Reputation: 2719
Try this,
If it array of String then use,
String[] some_array = getResources().getStringArray(R.array.your_string_array);
Or else
String date= getApplicationContext().getResources().getString(R.string.date);
Upvotes: 0
Reputation: 4082
just try below code for get your string from your project resource:
String date= getApplicationContext().getResources().getString(R.string.date);
Upvotes: 1