android string

www.lau‮c.irutt‬om
android string

use strings on android

strings.xml

<string name="title">Title Message</string>
<string name="sub_title">Sub Title Message</string>
<string name="welcome_messages">Hi, %1$s! You have %2$d new messages.</string>

code:

String username = "Lautturi";
Int msgCount = 12;
Resources res = getResources(); //previously done
String text = String.format(res.getString(R.string.welcome_messages), username, msgCount);

text variable:

Hi, Lautturi! You have 12 new messages.
Created Time:2017-08-31 10:14:33  Author:lautturi