I will call my App AndroidRoom2 -> Align all files with this name.
remember that we must not use JetPack Compose at all.
For your app AndroidRoom2, where we will demonstrate CRUD operations using the Android Room Persistence Library, an "Empty Activity" would be the best starting point.
This template provides a clean slate, allowing you to design your app from the ground up without any additional UI elements or configurations that you don't need.
Once you select "Empty Activity" and configure your app's name and save location, you can proceed to set up your activity and the associated XML layout file. This will give you the flexibility to create a user interface that includes a text box, a button, and other elements necessary for your shopping list application, without any unnecessary extras.
remember that we had incorrectly made the Android KOTLIN ROOM Database grocery list app to use JetPack compose and we will not be being JetPack compose at all ever. Now we must fix MainActivity.kt to remove all references to Composables and JetPack compose which we did. Now fix this error message in MainActivity.kt: e: file:///C:/AndroidStudioProjects/AndroidRoom2/app/src/main/java/com/example/androidroom2/MainActivity.kt:8:26 Unresolved reference: layout
Here is my current MainActivity.kt which must be fixed: import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.androidroom2.R // Import the R class
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) // Use the R class to reference the layout file
}
}
The error is at this line: setContentView(R.layout.activity_main) // Use the R class to reference the layout file
this is what you make before our session was interrupted: our need is make a simple Android Kotlin app using GRADLE DSL and avoiding any use of JetPack Compose. I want an app with a screen that presents a text box which the user enters a grocery item into and that text is stored in an Android KOTLIN ROOM database. Every time the user enters a grocery item into the text field, that item is persisted into the Room database and displayed on the screen. We will make ample use of LOGGING out to logcat so students can see the results of their code running.