簡體   English   中英

如何防止Android中“打開文件太多”的數據庫訪問錯誤消息?

[英]How can I prevent database access error message of “too many open files” in android?

我正在嘗試從文件導入。 我收到如下錯誤消息。 錯誤發生在getColumnIndex。 我如何防止這種情況發生。

Cursor c = activity.getContentResolver().query(android.provider.Browser.BOOKMARKS_URI, 
                null, 
                Browser.BookmarkColumns.TITLE+"=?",
                new String[]{title}, 
                null);
int idIndx = c.getColumnIndex(Browser.BookmarkColumns._ID);//error found here

堆棧跟蹤中的錯誤

cannot dup fd=1023, size=1048576, err=0 (Too many open files)
cannot map BpMemoryHeap (binder=0x682e50), size=1048576, fd=-1 (Bad file number)
E/JavaBinder( 5561): *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
E/JavaBinder( 5561): java.lang.RuntimeException: No memory in memObj
E/JavaBinder( 5561):    at android.database.CursorWindow.native_init(Native Method)
E/JavaBinder( 5561):    at android.database.CursorWindow.<init>(CursorWindow.java:518)
E/JavaBinder( 5561):    at android.database.CursorWindow.<init>(CursorWindow.java:27)
E/JavaBinder( 5561):    at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:493)
E/JavaBinder( 5561):    at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:496)
E/JavaBinder( 5561):    at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:103)
E/JavaBinder( 5561):    at android.os.Binder.execTransact(Binder.java:288)
E/JavaBinder( 5561):    at dalvik.system.NativeStart.run(Native Method)

完成使用后,您可以檢查是否關閉了游標。

我相信這是一個錯誤。 我希望我可以刪除這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM