Created class ItemMain . Its constructor accepts a String'овую variable.
I add an instance of the class to ListView:

 lists.add(new ItemMain(R.string.Home)); 

The error that R.string.Home is an integer type appears.
Tell me, how can you do it differently?

    1 answer 1

    R.string.Home is really the number-identifier of the resource of the project.

    To convert it to a string, there is a getString() method in the Context , Fragment , etc. classes.

    Ie, being in the activation / fragment / service, you should write like this:

     String stringFromRes = getString(R.string.Home); 

    it is better not to call resources with a capital letter and generally not to use large letters there

    • And what will it affect? - andrew
    • one
      It may not affect, but it is better not to try and write only lowercase plus underscores - YuriiSPb