此问题已报告多次,但仍未解决。我在 Samsung's developers site 中阅读了所有与该主题相关的消息/主题。或 in StackOverflow
让我再次用几句话描述整个问题:
开发人员过去常常通过简单的查询来获取 SMS 对话列表,例如:
Uri.parse("content://mms-sms/conversations/"); 游标 cursor = context.getApplicationContext().getContentResolver().query(uri, null, null, null, null);
或类似的东西。这里的关键点是 URI 地址:
content://mms-sms/conversations
每个人都知道这是非官方的,而且风险自负 - see proof link here
但是,这里的关键点是一个简单的事实,此代码仅在 Samsung Galaxy S3 和某些型号的 Galaxy Tab 2 中无法正常工作。它会产生带有堆栈跟踪的
NullPointerException
:java.lang.NullPointerException 在 android.os.Parcel.readException(Parcel.java:1431) 在 android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188) 在 android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140) 在 android.content.ContentProviderProxy.query(ContentProviderNative.java:366) 在 android.content.ContentResolver.query(ContentResolver.java:372) 在 android.content.ContentResolver.query(ContentResolver.java:315)
在世界/宇宙其他地方的所有其他设备中,它运行良好!奇怪吧?
我知道这样的答案:嘿老兄,这是你的问题,因为不能保证上述 URI 的存在/正确性,但是,有人有更有效的想法吗?
我已经通过他们的论坛向三星的开发者提出了问题。
最佳答案
最后我想出了如何克服上述问题(我不确定这是错误,但无论如何它看起来像错误)。
可以通过此查询检索对话列表:
Uri.parse("content://mms-sms/conversations?simple=true");
Cursor cursor = context.getApplicationContext().getContentResolver().query(uri, null, null, null, null);
此处的关键点是 URI content://mms-sms/conversations?simple=true
。
关于android - 与 SMS 对话列表相关的 SGS-3 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13553046/