android错误 : Channel is unrecoverably broken and will be disposed!

Uri uri = Uri.parse("content://com.android.contacts/data");
Cursor cursor = getApplicationContext().getContentResolver().query(uri, new String[]{"_id",}, null, null, null);
assert cursor != null;

代码部分代码如上:

然后出现   Channel is unrecoverably broken and will be disposed! 错误

原因是:cursor使用后没有关闭;

添加一行关闭代码即可:

cursor.close();

欢迎进(Q)群,帮你解决问题:

猜你喜欢

转载自blog.csdn.net/m0_38124502/article/details/86094320
今日推荐