简体   繁体   English

如何防止Android中“打开文件太多”的数据库访问错误消息?

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

I am trying to import from a file. 我正在尝试从文件导入。 I am getting error message like the following. 我收到如下错误消息。 The error occurred at getColumnIndex. 错误发生在getColumnIndex。 How can I prevent this from happening. 我如何防止这种情况发生。

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

Error in stacktrace 堆栈跟踪中的错误

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)

完成使用后,您可以检查是否关闭了游标。

I believe this is a bug. 我相信这是一个错误。 I wish I could delete this question. 我希望我可以删除这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM