I’m using MVVM to build my Android app and I need to connect the Model to a DB. Instead of Room I’m using the SQLiteOpenHelper and to make a connection to the DB I need the context. But since this is a non activity class I’m struggling to get it. My current solution looks as follows but I ke…
Tag: android
Android Studio mailto Intent doesn’t show subject and mail body
I’m trying to send an e-mail from my Android App. With the click on a button, gmail should open and show a new email with my previously defined recipient, subject and email body. So far I’ve tried sending the Intent.ACTION_VIEW as well as Intent.ACTION_SENDTO. Both show my draft with the recipient…
Android: get UsageStats per hour
I use UsageStats feature of Android, but the smallest interval is DAILY INTERVAL. How can I get UsageStats in an hourly interval? Answer All credit goes to this answer. I have learned from that one. How can we collect app usage data for customized time range (e.g. for per 1 hour)? We have to call queryEvents(…
Communication Between DialogFragment and Fragment
I am trying to pass information from my alert dialog to my second fragment (I am using tabbed activity layout). I want to pass information from alert dialog to fragment when I click on my ImageView, but my app keep crashing until I implement my interface inside MainActivity.java. My main mission here is to op…
Kotlin (null cannot be cast to non-null type) Custom Calendar Implementation
I am trying to use the library https://github.com/kizitonwose/CalendarView (which was made in Kotlin) in Java. In this library there is an example to select a date. In the example, it had shown to do this: After trying to replicate this in my own android project, I wrote this: When my fragment launches, it ca…
Error: Unable to determine the current character, it is not a string, number, array, or object in react-native for android
Whenever I run react-native run-android while keeping the emulator running, I get this error. react-native run-ios wroks completely fine. As indicated in the error message, I tried running npm uninstall -g react-native react-native-cli but it didn’t work. Info about my environment: android/app/build.gradle be…
UnsupportedOperationException with DriverManager.getConnection() on Android
I am unable to connect JDBC to my database, getting following error Answer According to the stacktrace, the MySQL Connector/J version you are using is using a java.util.regex.Matcher feature not supported on Android (probably named groups). The workaround is to use a 5.1.x version of MySQL Connector/J instead…
How to change RecyclerView LayoutManager from List to Grid?
I’m using a ViewPager in which I have a RecyclerView, in this RecyclerView I want to change the LayoutManager from List to Grid. I’ve implemented this code: On the RecyclerView’s onCreateViewHolder I have the following code: I make the change from List to Grid through a FloatingButton, chang…
Room compile problem – column references a foreign key but it is not part of an index
I’m new to android app development and am creating an app that has Trips which stores Locations. I’m getting a compile error :”trip_Id column references a foreign key but it is not part of an index. This may trigger full table scans whenever parent table is modified so you are highly advised…
Convert an existing Flutter Kotlin project to Flutter Java project
I created a Flutter project using default values, which are Kotlin for Android and Swift for iOS. Halfway through the project I needed to integrate a 3rd party Android SDK that requires Java. Can I convert a Flutter project to Java for Android after creation? I know I will need yo use Platform Channels to int…