android / codelab-android-room-with-a-view

Apache License 2.0
761 stars 495 forks source link

Unclear instructions in step 11. #159

Open aswe323 opened 3 years ago

aswe323 commented 3 years ago

Creating an xml file and using it in the android studio env are different things.

Where do I put the code provided? Do I override a file? create a new one? please be more precise in your instuctions.

"Make your application theme material by setting the AppTheme parent to Theme.MaterialComponents.Light.DarkActionBar. Add a style for list items in values/styles.xml:"

making an application theme material is not a clear instruction, neither have you required an understanding in how the xml files work in android to take the codelab.

"You need to be familiar with Java, object-oriented design concepts, and Android Development Fundamentals. In particular:

RecyclerView and adapters SQLite database and the SQLite query language Threading and ExecutorService It helps to be familiar with software architectural patterns that separate data from the user interface, such as MVP or MVC. This codelab implements the architecture defined in the Guide to App Architecture."

Please add clear instuctions to what TO DO with the provided XML code.

oliverClimbs commented 3 years ago

I totally agree with @aswe323 . The instructions in step 11 - especially the first part - "Make your application theme material by setting the AppTheme parent to Theme.MaterialComponents.Light.DarkActionBar. Add a style for list items in values/styles.xml:"

Where do you set the AppTheme??? There is no existing styles.xml file.

FauzanAdzhima commented 3 years ago

I write the AppTheme in the themes.xml file in themes folder, just replace anything in the file with the suggested one, and for the styles.xml, you have to create it manually

PS : I know it's kinda late, I just feel like giving some answer, in case someone had the same problem

diegum commented 3 years ago

Still adding styles.xml manually, the three colors colorPrimary, colorPrimaryDark and colorAccent aren't visible from that styles file. I'm using Android 4.2.1, created the RoomWordSample project from scratch as indicated.

        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
diegum commented 3 years ago

Likewise, add_word is missing in strings.xml (there's no indication to add it), so the app will fail to build, as it's referenced from activity_main.xml layout. No big deal, and a great exercise to students to guess by themselves; but the lab should probably tell about this.

UPDATE: in step 15, finally, they indicate to add it. But it's too late if step 11 ends suggesting to build the app and see if everything is OK so far.

FauzanAdzhima commented 3 years ago

Still adding styles.xml manually, the three colors colorPrimary, colorPrimaryDark and colorAccent aren't visible from that styles file. I'm using Android 4.2.1, created the RoomWordSample project from scratch as indicated.

        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>

Make sure you add the styles.xml file in the values folder, alongside with colors and strings file, and for the code in styles.xml like <item name="colorPrimary">@color/colorPrimary</item>, you need to define the item name first in the file colors.xml. In my case, I defined my colorPrimary with a color hex, it should be look like <color name="colorPrimary">#A1B8DF</color>. I still need to learn more about it, but I hope this one would help your issues.