In my app I have translated everything. This includes my dialogs also. As of yesterday, everything worked perfectly. Today I've added a String, for a new dialog. When I run my app, it provides me wrong Strings which is very weird.
For example, I call String x and y and he shows me String w and z. Not only in my new dialog, also in my existing dialogs! As for lables, he puts everything right. Have I done something wrong?
In my String.xml file I've declarated many Strings, here's an example of one he mixes up.
<string name="EvenGeduld">Even geduld...</string>
<string name="TweetProgress">De Tweets worden ingeladen</string>
<string name="Voornaam">Voornaam</string>
<string name="Geboortedatum">Geboortedatum</string>
This is my code for my dialog (it's set in AsyncTask class, dialog is declarated on top of my class, initialized in onCreate()):
dialog.setTitle(R.string.EvenGeduld);
Resources res = getResources();
String test = (res.getString(R.string.TweetProgress));
dialog.setMessage(test);
dialog.show();
try this.
activity.this.getResources().getString(R.String...etc);
and clean your project
Eclipse>>Project>>Clean
Yes, cleaning your project will do the trick, but there is an exception.
If you have any errors in your strings.xml file, it will cause bunches of problems just like this. And you do not always get an error message (so much for xml!). For me the culprit is usually ' or " in long strings (like help messages) that do not have a backslash before them, like \' and \".
Since these error are not always caught be Eclipse, you must look very very carefully, fix these errors, AND THEN "clean" your project.
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