Questions tagged [android-cursor]

android-cursor is an interface which provides random read-write access to the result set returned by a database query.

android-cursor is an interface which provides random read-write access to the result set returned by a database query.

Cursor provides a way to process data returned from a database, and provide features such as traversing the table, getting a certain row or column, and getting number of rows returned by the database.

It also allows to monitor a URI for changes using the setNotificationUri function, which tells that the data which the cursor has is old and it has to be updated.

Cursor Class Reference

878 questions
8
votes
2 answers

getSupportLoaderManager() use same ids in different fragments?

I am making a viewPager in a FragmentActivity with multiple ListFragments. In order to populate the different listviews i get the LoaderManager and initiliaze in the loader. I wanted to have a unique LoaderManager for each fragment, however,…
8
votes
4 answers

Inverted ListView in Android?

Is there an easy way to display a ListView in reverse order? I am trying to create a conversation-based app, and would like the most recent entries to be at the bottom of the ListView. I am aware of transcriptMode and stackFromBottom, however my…
bjdodson
  • 459
  • 2
  • 7
  • 11
7
votes
0 answers

Android cursorwindow memory error in a specific fragment

I have an android app that uses a service to collect sensor data every 5ms and inserts it into a sqlite table. In a typical session there will be about 40mins of recordings. All of that code seems to be working fine. I have a strange problem where…
Simon
  • 8,310
  • 14
  • 49
  • 108
7
votes
1 answer

Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)

I'm making an Kiosk app that use database. The app is running all time in foreground. The app have many threads that using one shared DataBaseHelper instance. the app works flawlessly but most of the time after 5 or 6 hour, I encounter these…
7
votes
2 answers

IllegalStateException: Invalid tables when trying to query database with ContentProvider

I am getting the below error when attempting to query my database with my custom ContentProvider shown below. I have confirmed the table exists with the correct name and it is still not working. I was able to get it to work with a raw query, but i…
prolink007
  • 30,784
  • 21
  • 111
  • 173
6
votes
1 answer

SQLite - Cross Database Query not working

I want to execute cross-database query in SQLite in Android. I have two tables in two different databases. attach database 'data/data/com.app/databases/db1' as db1; attach database 'data/data/com.app/databases/db2' as db2; SELECT db1.tbl1.* FROM…
6
votes
1 answer

Get Last Visited URL in Chrome and other browser's

I want to get last visited URL in chrome and other browser's. I am able to get Last URL in android Native browser. I use following code for this - Cursor cur = getContentResolver().query(Browser.BOOKMARKS_URI, new String[] {…
unflagged.destination
  • 1,474
  • 3
  • 16
  • 34
6
votes
4 answers

Retrieve images of particular folder in Android

In my application I created the GridView to show the image from particular folder. The issue is that I want to retrieve images from the DCIM/100ANDRO folder. Which type of arguments should be passed through query to retrieve such type of…
void
  • 449
  • 2
  • 11
  • 26
6
votes
3 answers

how to select unique contacts from android

i want to select unique contacts from android only that contacts which have phone numbers. i am using this code ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, …
6
votes
2 answers

SQLite query SQLiteLog (1) no such Column:

I have 3 classes. One to setup the DB and tables, works fine. DBHelper.java private static final String TAG = "DBHelper"; public static final String DB_NAME = "pat_test.db"; public static final String TABLE5 = "sites"; public static final String…
user1763585
  • 71
  • 1
  • 5
6
votes
1 answer

Query songs of an album with CursorLoader

I'd like to get the list of songs of an album by querying the MediaStore with CursorLoader How can i do this ? I can get all the songs of the device with this code : static final String[] TRACK_SUMMARY_PROJECTION = { MediaStore.Audio.Media._ID,…
Jecimi
  • 4,003
  • 6
  • 29
  • 38
5
votes
2 answers

AlphabetIndexer setCursor doesn't update its cache

I'm trying to implement a fast scroller with AlphabetIndexer, but when the cursor changes, its not refreshing the index chache. In my CursorAdapter constructor I call setCursor(cursor) but nothing changes, and acording to the documentation: Your…
rogcg
  • 10,281
  • 20
  • 84
  • 128
5
votes
1 answer

Several different crashes with Android Room database - NO IDEA WHY

We've been having some trouble with Android's Room database lately. The crashes happen only to certain users, but I cannot reproduce it on my testing device(s) or emulators. (This also happens SOMETIMES on Firebase test devices) There are a few…
dasfima
  • 3,203
  • 2
  • 16
  • 19
5
votes
7 answers

Sorted list of contacts having duplicates ,why?

I have sorted and listed my phone contacts in to an arraylist but ,i got many duplicates of same contact names in the list .How this happens? how to avoid this? This is what i have tried, cursor =…
Jack
  • 1,397
  • 2
  • 14
  • 39
5
votes
1 answer

Intent.ACTION_GET_CONTENT opens recent files which gives a bad URI

I'm using Intent.ACTION_GET_CONTENT which opens recent files. Selecting items from the recent files gives a bad URI but selecting the same file from the file manager gives a right URI which can be handled by my code. public static String…
Alireza
  • 1,340
  • 1
  • 17
  • 41
1 2
3
58 59