String.xml provides me with an invalid string for ProcessDialog

In my application, I translated everything. This also includes my dialogues. Since yesterday, everything worked fine. Today I added a line for a new dialogue. When I run my application, it provides me with incorrect lines, which are very strange.

For example, I call String x and y, and it shows me String w and z. Not only in my new dialogue, but also in my existing dialogs! As for the tables, it's all right. Did I do something wrong?

In my String.xml file, I declared a lot of lines, here is an example of one that it mixes.

<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 is installed in the AsyncTask class, the dialog is declared 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(); 
+6
source share
2 answers

try it.

 activity.this.getResources().getString(R.String...etc); 

and clean the project

 Eclipse>>Project>>Clean 
+6
source

Yes, cleaning up your project will do the trick, but there is an exception.

If you have errors in the strings.xml file, this will cause problems with the same problems. And you do not always get the error message (so much for xml!). For me, the culprit is usually "or" in long lines (like help messages) that don't have a backslash in front of them, like "\" and ".".

Since these errors do not always fall into Eclipse, you must be very careful, correct these errors, and then β€œclean” your project.

+1
source

Source: https://habr.com/ru/post/888985/


All Articles