android-cursor

RecyclerView not updating after calling changeCursor

我怕爱的太早我们不能终老 提交于 2020-08-10 13:12:10
问题 Background: I have an orders table in my database whose data I show in RecyclerView . I do it by using a CursorAdapter in RecyclerView.Adapter . All of this is done in parent activity. Besides this I have a child activity which is responsible for adding new orders to orders table and then coming back to parent activity to show all the orders in RecyclerView including the newly ones just created. New orders are added by starting a child activity in addOrder() . Problem: When I come back from

Get Last Visited URL in Chrome and other browser's

一笑奈何 提交于 2020-03-13 05:27:20
问题 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[] { Browser.BookmarkColumns.URL }, null, null, BookmarkColumns.DATE + " DESC"); if (cur != null && cur.getCount() > 0) { cur.moveToFirst(); String url = cur.getString(cur .getColumnIndex(Browser.BookmarkColumns.URL)); cur.close(); return url; } else { if (cur != null) { cur

Get Last Visited URL in Chrome and other browser's

99封情书 提交于 2020-03-13 05:26:23
问题 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[] { Browser.BookmarkColumns.URL }, null, null, BookmarkColumns.DATE + " DESC"); if (cur != null && cur.getCount() > 0) { cur.moveToFirst(); String url = cur.getString(cur .getColumnIndex(Browser.BookmarkColumns.URL)); cur.close(); return url; } else { if (cur != null) { cur

SQLiteBlobTooBigException still occurs after dividing the request in chunks of 1 MB (and cursor.close())

走远了吗. 提交于 2020-01-19 06:20:12
问题 It is possible to import a text file of 6MB directly into my database. However, the text can't be extracted since CursorWindow has a limit of 2MB. (I should have used files, but some users already have this problem and I would need to read the entire text to be able to put it in a file) I used substr (a special SQL function) to only request 1 MB and it worked. However, the following while loop doesn't work after the second iteration (which means that even if I called cursor.close(), the

SQLiteDatabase Cursor empty only on Android 5.0+ devices

人走茶凉 提交于 2020-01-15 23:05:29
问题 The application has a SearchView which fetches suggestions from a specific database table. Everything worked without any errors until Android 5.0 appeared. As of then, when the SQLiteQueryBuilder queries the database to fill the Cursor object, the return is empty cursor. Not NULL , but empty. On other platforms, I can output the Cursor 's content via DatabaseUtils.dumpCursorToString(cursorObject) , but on Android 5.0+ the method reports output on null objects Dumping cursor null <<<<< Even

Using SQLite cursor to output table contents in listview in a fragment

删除回忆录丶 提交于 2020-01-05 04:26:30
问题 I have MyDBHandler with a getAllDetails method that queries the database using a cursor and returns a list. What I don't know what to do now is how to output this list in a listview in another fragment. I was told to create two XML layouts and a custom adapter but I don't know how to this exactly! MyDBHandler class package com.astuetz.viewpager.extensions.sample; import android.content.ContentValues; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android

IllegalStateException: database already closed (using ViewPager)

蹲街弑〆低调 提交于 2020-01-02 04:44:09
问题 I'm stumped as to what is causing this error, as I have made sure that I am closing my database adapter properly (at least I think I am). Here's what LogCat's saying (the tag for all of them is AndroidRuntime): FATAL EXCEPTION: main java.lang.IllegalStateException: database /data/data/com.acedit.assignamo/databases/data.db (conn# 0) already closed at android.database.sqlite.SQLiteDatabase.verifyDbIsOpen(SQLiteDatabase.java:2082) at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase

Intent.ACTION_PICK returns empty cursor for some contacts

谁都会走 提交于 2020-01-02 00:55:15
问题 I have an app in which one aspect is for a user to select a contact and send a text to that contact thru the app. The app only works with some contacts and fails on others. More precisely: for the contacts that I entered into my contact book by hand, the Intent.ACTION_PICK has no trouble finding and returning them to the app, i.e. cursor.moveToFirst() is true. But for the contact that were imported by Facebook (my phone is set to sync with Facebook contacts), I get the following android