cursor

Unable to resume Activity error

依然范特西╮ 提交于 2019-12-04 01:12:29
My Activity contains this code to get all images on the SD card: String[] projection = {MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA, MediaStore.Images.ImageColumns.DATA}; Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, MediaStore.Images.Media._ID); int count = cursor.getCount(); int image_path_index = cursor.getColumnIndex(MediaStore.Images.Media.DATA); int i; for(i = 0; i < count; i++) { cursor.moveToPosition(i); String p = cursor.getString(image_path_index); fd.addToPhonePhoto(p); } cursor.close(); The occurred while the

MongoDB - Why should I use a cursor instead of iterator_to_array (in PHP)

懵懂的女人 提交于 2019-12-04 00:31:19
问题 The PHP documentation for the mongo class says using a cursor instead of iterator_to_array is superior. Why? What benefits/flexibility will I get from that? 回答1: Using iterator_to_array() makes your driver load all of the results into memory at once, and you could easily run out of memory. This would not be the case with a cursor, which uses lazy-loading! Straight from the linked docs: <?php $cursor = $collection->find(); var_dump(iterator_to_array($cursor)); ?> ... Suppose that, in the

How to update listview whose data was queried from database through SimpleCursorAdapter?

本秂侑毒 提交于 2019-12-03 22:53:26
问题 I want to show the items queried from database in the listview with SimpleCursorAdapter. For example, there may be 20,000 items in the database. I want to just load 100 items(_id : 1-100) queried instead of load all items, when scrolling in the end of listview, load another 100 items(_id : 101-200) queried, how to achieve it? Any suggestion is welcome, thanks. Relative codes are as follows: protected void onCreate(Bundle savedInstanceState) { mCursor = managedQuery(CONTENT_URI, PROJECTION,

Error when trying to access Cursor data

怎甘沉沦 提交于 2019-12-03 22:47:29
I have a populated Database in my app but I'm having trouble to access data through a returned cursor from the query method. Cursor query = getContentResolver().query(MoviesContract.MoviesEntry.CONTENT_URI, null, null, null, null); query.moveToFirst(); while (query.isAfterLast() == false){ Log.d("Test", query.getString(0)); query.moveToNext(); } I'm doing tests on this block of code. When I execute the Log.d line, this error is raised: java.lang.IllegalStateException: Couldn't read row 0, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. This

gltf cursor-listener click event in A-frame

…衆ロ難τιáo~ 提交于 2019-12-03 22:22:41
问题 I am unable to figure out why cursor-listener works fine for all the entities except for my gltf model. Here is my html <div id="myEmbeddedScene"> <a-scene embedded=""> <a-assets> <a-asset-item id="ducks" src="../images/test.glb"></a-asset-item> </a-assets> <a-box cursor-listener color="#CCC" width="3" depth="3" height="0.1" position="0 0 -2"></a-box> <a-entity cursor-listener id="duck" gltf-model="#ducks" position="0 0.1 -2" rotation="0 -90 0"></a-entity> <a-camera> <a-cursor></a-cursor> </a

Passing a cursor to an activity?

那年仲夏 提交于 2019-12-03 22:12:46
问题 Is this possible? I am trying to open a SQLite database cursor in one activity, and pass it to another activity. 回答1: I personally don't know of any simple ways to do this. It might be easier just to make the query again in the destination activity. 回答2: Another way to do this which might be easier is to create an Application class for your app. This is guaranteed to be created only once, and exists for the lifetime of your app. Among other things, it can provide a "data hub" capability for

How to clone or freeze an Android database cursor

佐手、 提交于 2019-12-03 21:57:06
问题 I have a custom cursor adapter, and I would like to pass each 'row' of the cursor back to the application (via a registered callback which is working). I know I could read each of the fields from the cursor and do it manually, but I would simply like to pass a 'frozen clone' of the cursor back. (Reading the fields in the adapter would require me to make several specialised versions of this class.) Ideally I would like to pass back something with the same interface as Cursor, but which couldn

Android cursor Error : Make sure the Cursor is initialized correctly before accessing data from it

给你一囗甜甜゛ 提交于 2019-12-03 21:50:56
I am going to implement the method to retrieve the record of the strings but when it comes to the execution , it turns Runtime Error as the Log cat stated. Would you please tell us how in correctly initialise the cursor ? Logcat 07-08 10:10:34.620: D/result(8036): true 07-08 10:10:34.660: D/memalloc(8036): ion: Unmapping buffer base:0x57c06000 size:466944 07-08 10:10:34.660: D/memalloc(8036): ion: Unmapping buffer base:0x57d6c000 size:466944 07-08 10:10:34.660: D/memalloc(8036): ion: Unmapping buffer base:0x57cbb000 size:466944 07-08 10:10:34.710: D/debug(8036): Order 87318702 07-08 10:10:34

StaleDataException: Attempted to access a cursor after it has been closed

倾然丶 夕夏残阳落幕 提交于 2019-12-03 21:24:40
FATAL EXCEPTION: main Process: com.example.lenovo.phone, PID: 4885 android.database.StaleDataException: Attempted to access a cursor after it has been closed. at android.database.BulkCursorToCursorAdaptor.throwIfCursorIsClosed(BulkCursorToCursorAdaptor.java:64) at android.database.BulkCursorToCursorAdaptor.requery(BulkCursorToCursorAdaptor.java:133) at android.database.CursorWrapper.requery(CursorWrapper.java:186) at android.app.Activity.performRestart(Activity.java:5309) at android.app.ActivityThread.handleSleeping(ActivityThread.java:3514) at android.app.ActivityThread.access$2900