Home > Software design >  What dependency should be used to get row id from resources without using R class?
What dependency should be used to get row id from resources without using R class?

Time:06-29

Like this:

val myString = getString(string.hello_from_vb_activity)

Not like this:

val myString = getString(R.string.hello_from_vb_activity)

An example from Google

CodePudding user response:

import com.android.example.viewbindingsample.R.string
//import yourPackageName.R.string

you can import string like this then it will look as you expect

By the way this does same job.

R.string.any_string

string.any_string

in both case you are using R class

  • Related