草庐IT

database_cursor

全部标签

android - cursor.setNotificationUri() 和 getContentResolver().notifyChange(uri,null) 之间的区别

我是android的新手,谁能告诉我cursor.setNotificationUri()和getContentResolver().notifyChange(uri,null)在实现时有什么区别内容提供商。我已经看到cursor.setNotificationUri()在query()方法中使用,同时更新或插入getContentResolver().notifyChange()被使用。我不太了解getContentResolver().notifyChange()通知解析器某些数据已更改,但cursor.setNotificationUri()做了什么?

android.database.sqlite.SQLiteException : near "...": syntax error (code 1)

当我打开我的RSS应用程序时,我想检查我的数据库中是否存在一篇文章。如果存在,我想将其删除(或忽略),如果不将其写入数据库。我一直在尝试这样做:Cursorcursor=ourDatabase.rawQuery("select1from"+DBHelper.DATABASE_TABLE+"where"+DBHelper.TITLE+"='"+title+"'"+"AND"+DBHelper.DATE+"='"+date+"'",newString[]{});if(cursor.moveToFirst()){booleanexists=(cursor.getCount()>0);curs

android - 致命异常 : unknown error (code 14) could not open database

我的应用程序抛出了这个FatalException:unknownerror(code14)couldnotopendatabase在AndroidKitkat4.4上运行时,该应用程序在所有以前的版本上都能完美运行。此行抛出异常。myDataBase=SQLiteDatabase.openDatabase("path",null,SQLiteDatabase.OPEN_READWRITE);我已经尝试了一切SQLiteDatabase.create();SQLiteDatabase.opendatabase();SQLiteDatabase.openorcreatedatabase(

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

这是fragmentActivity,当我按下主页按钮时它强制关闭,错误是在关闭后尝试访问光标。错误在哪里。我也尝试使用getContentResolver().query()而不是managedQuery()同样的错误。我的MainActivity是SherlockFragmentActivity选项卡和View寻呼机privateCursorgetInternalAudioCursor(Stringselection,String[]selectionArgs){returngetActivity().managedQuery(MediaStore.Audio.Media.INTE

android - 试图访问关闭的 CursorWindow。最可能的原因是 : cursor is deactivated prior to calling this method

如何解决给定的错误?当我尝试从操作栏刷新光标时会发生这种情况,有时当我在长按列表项后尝试再次删除时会发生这种情况。主Activity.javapublicclassMainActivityextendsAppCompatActivity{privatefinalStringQUERY_SELECTALL="SELECT*FROM"+RjecnikDB.TABLE;privateRjecnikCursorAdapteradapter;privateRjecnikDBdbRjecnik;privateSQLiteDatabasedb;privateCursorcursor;@Overrid

Android 9 上的 android.database.sqlite.SQLiteCantOpenDatabaseException

我的应用程序已上线并从GooglePlay控制台收到“由:android.database.sqlite.SQLiteCantOpenDatabaseException:”引起的崩溃。它主要发生在Android9操作系统上,并且50%的所有设备都是GooglePixel设备。我尝试使用其他装有android9的设备,但没有成功。我没有GooglePixel设备。无论如何,请有人建议我修复它或复制它。 最佳答案 我不知道发生这种情况的原因,但您可以使用firebase测试实验室重现此错误。它包含多个具有多个sdk版本的设备,包括goo

解决报错 java.sql.SQLNonTransientConnectionException: Could not create connection to database server

启动Spring项目报错java.sql.SQLNonTransientConnectionException:Couldnotcreateconnectiontodatabaseserver.Attemptedreconnect3times.Givingup. atcom.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) atcom.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) atcom.mysql.c

android - 找不到处理 Intent 的 Activity { act=android.intent.action.EDIT typ=vnd.android.cursor.item/event

我正在编写一段代码,其中我允许用户使用Intent将事件添加到日历中,但是每当我尝试将事件插入到较低版本中时,都会得到:不幸的是应用程序已停止和错误是:android.content.ActivityNotFoundException:NoActivityfoundtohandleIntent{act=android.intent.action.EDITtyp=vnd.android.cursor.item/event(hasextras)}AndroidManifest.xml:-Java代码:-finalButtonbutton=(Button)findViewById(R.id.

android - Cursor.moveToNext() 返回 false 而 Cursor.getCount() 表示超过 1 行

我正在我的Sqlite数据库中运行查询..我将结果保存在我的Cursor中,我正在遍历它以获得所有结果..allotugh我正在检查并看到游标有超过1行,它只给我第一行,因为moveToNext()总是返回false..这是我的迭代代码:Cursorcursor=getEventsDetails(db,selection,null);Log.e("cursorbefore","count"+cursor.getCount());booleanmoveToNext=cursor.moveToFirst();if(moveToNext){do{//CreateanewPicoEventin

android - cursor.moveToPosition(i) 有多快?

想知道调用cursor.moveToPosition(i);会触发持久存储操作,还是只是从内存缓存中读取?在Android的RecycleViewAdapter中,这个调用非常频繁,我不想让系统过载访问持久存储。这种风险是否存在?Cursorcursor=MainActivity.db.rawQuery("Select_idFromUserSetting",null);操作是否会产生缓存结果?@OverridepublicvoidonBindViewHolder(ItemHolderitemHolder,inti){cursor.moveToPosition(i);inti2=curs