I have this code in the string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hint_input_user_es">EMAIL:</string>
</resources>
And what I want is to get "EMAIL" and display it in a textView as Hint. I have tried it in several ways and with all of them I get the same error.
TextView login_email = (TextView) findViewById(R.id.login_email);
1. login_email.setHint(getText(R.string.hint_input_user_es));
2. login_email.setHint(getResources().getString(R.string.hint_input_user_es));
3. login_email.setHint(getString(R.string.hint_input_user_es));
And in all cases I get this error:
android.content.res.Resources$NotFoundException: String resource ID #0x7f05002b
Thank you so much.
I managed to test this code and it works correctly
But it seems to me that the TextView, even if it has a Hint field, does not apply for that information to be displayed on the screen.
Perhaps you may have thought more of an EditText? Since in the EditText when there is nothing written, it shows the Hint
Note: I tried the same code with an EditText and it works too
The value of the "hint" or text can be set programmatically without any problem :
or directly in sight.
Regarding the bug:
at some point in your code you are assigning either the setHint() or setText() method an integer value, you can test yourself to see what I'm saying.
I add a similar answer:
Error android.content.res.Resources$NotFoundException: String resource ID #0xbb8 on Android