Relative Content

Tag Archive for androidkotlinandroid-room

Database not showing up in App Inspector or Device Explorer?

I’m a beginner working on my first app. This is my first time making a database and I seem to have run into a problem with the database. For some reason, it won’t show up in the app inspector (Database inspector says “nothing to show”). I’ve tried the obvious: invalidate cache and restart, updating android studio, restarting the emulator, creating a new emulator, increasing the database version, logging debug messages from inside the functions I’m using, rebuilding. I thought it was being initialized because I added a statement that checks if the Instance variable (holds database) is null, then logs the result to the database, and it comes back saying it isn’t null, but when I check in Device Explorer there aren’t any files in the app’s databases directory. So it seems like it isn’t. It’s not throwing any errors that I can tell, so I feel like in theory, I should be able to see the database! I had it working before, but then I changed the schema a bit and tried (and failed) to upgrade to ksp (ended up going back to kapt because I couldn’t for the life of me get ksp to work), and I also added some type converters (that I’ve now commented out to rule out that issue). Then it just stopped working? The next time I opened the inspector with the app running, it showed up as closed, then I wiped the data on the emulator to start with a clean slate, and that’s where I’m at now. I should also mention I’m kinda basing this off the Android Basics with Compose Course that Google provides.

How can I implement a feature to export and import database to my app in android(Kotlin)

How can I add feature to export and import database to my app. currently I am learning the data persistence using room. I have created a database and I want that my user should be able to export and import database. Lets say my user wants to share the database to a another user. How can I implement a feature so that my user can simply export the database and share it using any app like WhatsApp , email or something like that and then other user should just be able to import it to his app.

Updating a variable in Room database using the UPDATE statement

I have a program that works on two devices for transferring files broken into parts, when sending from one device to another, for example, a picture, the number of bytes is received in the count variable, then I am going to connect the progressbar, the problem is saving the values, for example if the file weighs 20 kilobytes, I receive 20,000 parts, which I save using the update method, that is, I take a variable in the database and add new values ​​to it at each iteration, in theory, progress should reach 100%, however, the update method does not saves some values ​​from iterations, simply skipping them without saving, subsequently the progressbar value does not reach 100%, what am I missing?

updating a variable in the room database using the update method

Good day, I have a program that works on two devices for transferring files broken into parts, when sending from one device to another, for example, a picture, the number of bytes is received in the count variable, then I am going to connect the progressbar, the problem is saving the values, for example if […]