I have a table with the following I am trying to get all the data at a given rowid I get an error I did populate the table. How do I return a cursor based on the position of entry. Answer How do I return a cursor based on the position of entry First, your method getRowCursor() should return a
Tag: android
Best practice: weak reference to activity in static method
I need to reference an activity in several static methods. I’m curious to know the best practices to avoid memory leaks. Let’s use examples: Example 1: Example 2: So three questions: Do example 1 or 2 make any difference? I haven’t seen methods being called this way much outside of subclasse…
How to pass custom objects from an activity to a fragment?
I’ve been searching all day and couldn’t find a real answer. I created a fragment using the correct way, that is with a no-args constructor and using Fragment setArguments(Bundle) to pass data to it. I need to pass a Drawable and another custom object to the fragment. Everything I read talks about…
How to set color effect on document(image) using OpenCV(java)
currently, I’m working on a document scanner project who captures and filter document with different effects and color but I’m a beginner to work with OpenCV. but, now I understand how medianBlurFilter , gaussianBlurFilter , cannyFilter and bilateralFilter works. just I am starting to do this type…
How to load a different database file with Room?
Goal I have an app with plenty of data, with a switch button, which switch the language (french or english) of the entire app. However, some of my data are stored in a Room database. I have two .db files : database_fr.db and database_en.db. Let’s say the app is currently in french, with the database_fr.…
How do I retrieve data under UID for the signed in user with Firebase
I saved some data under a node with the currently signed in user UID, along with the post timestamp.I successfully manage to retrieve all the data under this node, but I would only like to retrieve the data for the currently signed in user, I am trying to create something similar to how amazon stores an item …
java.io.FileNotFoundException in Android accessing files on Google Drive
I tried to read the csv file inside Google Drive through the link. But it’s accessible or impossible. If it return the requestCode, it will also return ‘200’, but in most cases it will return ‘403’. I thought about it for a few days, but I don’t know why I can’t appro…
How do I display child of child’s data from firebase in my RecyclerView?
I want to show data of all children inside all the Categories from the database (added the image below of what my database looks). I am adding data to my RecyclerView using the adapter which needs FirebaseRecyclerOptions object to be passed. I saw one answer where DataSnapshot was used to get child of child d…
Gradle build: Java plugin not compatible with Android plugins
When I build, I have the error The ‘java’ plugin has been applied, but it is not compatible with the Android plugins. The internet answers says to remove the line “apply plugin: ‘java’” and the file gradle.init, but I can find neither in my environment… Where exactly is the…
How to schedule a periodic background work to activate at fixed times?
I want to push a notification every 12 hours at fixed times (lets say for an example, 9am and 9pm, every day). This is my current doWork() code: ` and this is the work creation code: I saw some people doing it with calendar but I don’t understand how it works. Answer I have found a simple solution, usin…