The problem: Installing on an Android device that has an old version of an app I’m developing triggers an error: Room Database Migration: java.lang.IllegalStateException: Migration didn’t properly handle Problem persists despite uninstalling the Android app and deleting all app data. The solution: Very simple. I set allowBackup to false in my AndroidManifest.xml file like so: […]
I am trying to make a single-activity app because I’d like to easily share data across screen using, ideally one, or as few as possible ViewModels. NavGraph 1 Host: Layout file of MainActivity Destination(s): CreateLogFragment NavGraph 2 Host: Layout file of CreateLogFragment Destination(s): CreateLogFoodFragment, CreateLogNotesFragment (CreateLogFragment has a BottomNavigationBar that switches between CreateLogFoodFragment and CreateLogNotesFragment) […]
I have been working on small Android apps, and I just want to share some of my favorite keyboard shortcuts. Some of them were manually added by me. Keyboard shortcuts are one of my must-haves for productivity as a programmer, as they let me navigate through code faster, allowing me to focus on creating new […]
The problem is that this line of code is producing an error: And the error says: Type mismatch.Required:ActivityMainBindingFound:ViewDataBinding! The solution is to add a <layout> tag in the layout file that you are inflating!
I have the following XML layout code in an Android app that I’ve been tinkering with: I wrapped my GridLayout in a ScrollView because on the landscape orientation of the Android app’s screen, my grid contents are cut from the view because they’re too tall, and there’s no way to see them without a scrollbar, […]
First I added the following UI Automator to my app: So now my build.gradle (Module) file has the following dependecies: Then under the package app/src/androidTest/java/net/catzie/samplecalculatorapp I added the following instrumented test class: What it does is press the buttons 1, period, and 5 on the calculator’s UI to show “1.5” which should show up the […]
I have been playing around with Android app development, particularly on how to retain UI values after configuration changes and minimizing the app to launch a different one. To retain values after configuration changes, I use ViewModels. And to retain values after minimizing the app, the following is supposed to do the trick: But in […]
I’m starting a new category on my blog — Dev Diary, to document some of the errors that I encounter and what I did to fix them. I’m doing this in hopes of helping developers (including my future self!) as they work with code (and to get more blog visits! LOL). It’s nice to save […]