Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:cursor.close()在使用registerContentObserver时_Android_Cursor_Contentobserver - Fatal编程技术网

Android:cursor.close()在使用registerContentObserver时

Android:cursor.close()在使用registerContentObserver时,android,cursor,contentobserver,Android,Cursor,Contentobserver,使用时是否必须关闭光标 startManagingCursor(cursor); //I know its deprecated 及 如果是,在哪里关闭它?如果使用startManagingCursor您不需要关闭光标,Activity将为您解决此问题 但是如果您已经调用了registerContentObserver,则需要调用unregisterContentObserver。通常在OnResume中调用registerContentObserver,在OnPause中调用unregis

使用时是否必须关闭光标

 startManagingCursor(cursor); //I know its deprecated


如果是,在哪里关闭它?

如果使用
startManagingCursor
您不需要关闭光标,Activity将为您解决此问题

但是如果您已经调用了
registerContentObserver
,则需要调用
unregisterContentObserver
。通常在OnResume中调用registerContentObserver,在OnPause中调用unregisterContentObserver,但它可能会根据您在
ContentObserver
中执行的操作类型而变化

cursor.registerContentObserver(..