0

Hello guys!

I have got a problem, I want to make my app display the device name (if your [DEVICENAME] is rooted or not) in the strings.xml, I have already tried many things, but nothing really worked.

Please tell me how to do that! It should work in Toasts made with MainActivity.java.

Max
  • 348
  • 2
  • 13

2 Answers2

1

You can do it as follow.

In your strings.xml:

<string name="device_rooted">if your %s is rooted or not</string>

And in Java:

context.getString(R.string.device_rooted, android.os.Build.MODEL);
Gaëtan
  • 11,912
  • 7
  • 35
  • 45
0

In your strings.xml,

<string name="device">if %s is rooted or not.</string>

And in your Activity

getString(R.id.device, android.os.Build.MANUFACTURER + android.os.Build.PRODUCT);
siriscac
  • 1,699
  • 12
  • 21