I'm facing the Problem that getString() returns not the String of the id but another string. But first here is my Code:
public public class ShopFragment extends Fragment {
...
public class ShopManager(){
...
private TableRow[] getRowsFromItems(){
...
TextView headlineName = new TextView(getContext());
headlineName.setText(getString(R.string.shop_headline_name));
TextView headlinePrice = new TextView(getContext());
headlinePrice.setText(getString(R.string.shop_headline_price));
...
}
}
}
strings.xml:
<resources>
...
<string name="show_leaderboards">Leaderboards</string>
<string name="show_achievements">Achievements</string>
...
<string name="shop_headline_name">Article</string>
<string name="shop_headline_price">Price</string>
...
</resources>
The Problem is, that getString(R.string.shop_headline_name) returns "Achievements" and getString(R.string.shop_headline_price) returns "Leaderboards". I have no idea how to fix this and I'm quite confused why this happens. What am I doing wrong? Thanks for your answers
Clean and build should do the trick. Your R.java, which holds all the ids, was not generated properly. A clean and build will generate it properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With