[Solved] Where is simple_list_item_1

#1

Hi.

I came to page 183 of the book (second edition), here is mentioned a layout simple_list_item_1

https://scontent.feoh2-1.fna.fbcdn.net/v/t1.0-9/16427407_10155084914187342_7362317359874202206_n.jpg?oh=7fff96f73f9ec793fd2af66fa61c9848&oe=5948B053

I missed something or are talking about crime_recycler_view (fragment_crime_list.xml)?

Thanks

#2

The book uses android.R.layout.simple_list_item_1. Make sure that you have android in the name.

Android comes with its own R file with some resources, just like your project has its own R file.

#3

Hi.

Thanks for answering.

In the book it doesn’t mention anywhere where to create the simple_list_item_1 file.

If I am wrong, please could you tell me which page the book mentions about creating this file.

I think it’s an errata of the book.

#4

You do not create this file. It is built in to the platform.

For your code to work, change:

R.layout.simple_list_item_1

To:

android.R.layout.simple_list_item_1

When you use the android name before the R file, you are accessing Android’s built in resources.

#5

Okay. Thanks, now I understand what it was. The problem has been fixed.