Answers for "get string android java"

2

android string java

Let's say you want to display this and also translate it:
Hello, [display name]! You have [display an other variable] new messages.

Put your string in the strings.xml file with this %n$s as fields:
<string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>

Get and set in your class in this way:
Resources res = getResources(); //previously done
String text = String.format(res.getString(R.string.welcome_messages), username, mailCount);
Posted by: Guest on January-03-2022
0

how to get string value in java in android

String mess = getResources().getString(R.string.mess_1);
Posted by: Guest on September-25-2021

Code answers related to "get string android java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language