开发者

How can I prevent database access error message of "too many open files" in android?

开发者 https://www.devze.com 2023-01-22 11:44 出处:网络
I am trying to import from a file. I am getting error message like the following. The error occurred at getColumnIndex. How can I prevent this from happening.

I am trying to import from a file. I am getting error message like the following. The error occurred at 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(Bro开发者_StackOverflow社区wser.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)


You may check if you have closed cursor when you have finished working with it.


I believe this is a bug. I wish I could delete this question.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号