I'm developing SMS application and need to listing SMS conversation. I found problem when trying to access content provider using uri content://mms-sms/conversations/
. It's runs well on Android 2.3 but when run at Android 4.0.3 Samsung galaxy tab 2 it return error :
10-17 09:04:51.035: E/AndroidRuntime(22600): FATAL EXCEPTION: main
10-17 09:04:51.035: E/AndroidRuntime(22600):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.yooi/com.yooi.ui.MainActivity}:
android.view.InflateException: Binary XML file line #6: Error
inflating class fragment 10-17 09:04:51.035: E/AndroidRuntime(22600):
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.ActivityThread.access$600(ActivityThread.java:128) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.os.Handler.dispatchMessage(Handler.java:99) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.os.Looper.loop(Looper.java:137) 10-17 09:04:51.035:
E/AndroidRuntime(22600): at
android.app.ActivityThread.main(ActivityThread.java:4514) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
java.lang.reflect.Method.invokeNative(Native Method) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
java.lang.reflect.Method.invoke(Method.java:511) 10-17 09:04:51.035:
E/AndroidRuntime(22600): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
dalvik.system.NativeStart.main(Native Method) 10-17 09:04:51.035:
E/AndroidRuntime(22600): Caused by: android.view.InflateException:
Binary XML file line #6: Error inflating class fragment 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.view.LayoutInflater.inflate(LayoutInflater.java:489) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.view.LayoutInflater.inflate(LayoutInflater.java:396) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.view.LayoutInflater.inflate(LayoutInflater.java:352) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:273)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.Activity.setContentView(Activity.java:1835) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
com.yooi.ui.MainActivity.onCreate(MainActivity.java:17) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.app.Activity.performCreate(Activity.java:4465) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
10-17 09:04:51.035: E/AndroidRuntime(22600): ... 11 more 10-17
09:04:51.035: E/AndroidRuntime(22600): Caused by:
java.lang.NullPointerException 10-17 09:04:51.035:
E/AndroidRuntime(22600): at
android.os.Parcel.readException(Parcel.java:1334) 10-17 09:04:51.035:
E/AndroidRuntime(22600): at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:181)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.content.ContentProviderProxy.query(ContentProviderNative.java:358)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.content.ContentResolver.query(ContentResolver.java:311) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
com.yooi.ui.SmsThreadListActivity.getThreadListCursor(SmsThreadListActivity.java:146)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
com.yooi.ui.SmsThreadListActivity.onCreateView(SmsThreadListActivity.java:95)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:806)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1010)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1108)
10-17 09:04:51.035: E/AndroidRuntime(22600): at
android.app.Activity.onCreateView(Activity.java:4243) 10-17
09:04:51.035: E/AndroidRuntime(22600): at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
10-17 09:04:51.035: E/AndroidRuntime(22600): ... 21 more
I'd been spent my time search it on google but still not found the answer. Anyone who know please help me, I'm stuck for this annoying problem :(
List of conversations can be retrieved through this query:
Uri.parse("content://mms-sms/conversations?simple=true");
Cursor cursor = context.getApplicationContext().getContentResolver().query(uri, null, null, null, null);
Keypoint here's URI content://mms-sms/conversations?simple=true
.
Look here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With