googlearchive / android-DirectorySelection

Deprecated
Apache License 2.0
111 stars 51 forks source link

Not working #2

Closed Kostya1375 closed 9 years ago

Kostya1375 commented 9 years ago

This sample isn't working on Xiaomi mi-4c. MIUI version: MIUI 7 5.11.26 | Beta. Android version: 5.1.1 LMY47V

keyboardsurfer commented 9 years ago

Please add more information, like how to reproduce the issue or a relevant logcat snippet. Based on the information you provided we're unable investigate this issue.

Kostya1375 commented 9 years ago

To reproduce it you can simply press "Open directory" button. Surely, this issue can be caused only on device with MIUI OS.

keyboardsurfer commented 9 years ago

Please attach your device to a development machine, run adb logcat and provide the relevant part of the resulting output here.

Kostya1375 commented 9 years ago
E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                        Process: com.example.android.directoryselection, PID: 21464
                                                                                        android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT_TREE }
                                                                                            at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1781)
                                                                                            at android.app.Instrumentation.execStartActivity(Instrumentation.java:1501)
                                                                                            at android.app.Activity.startActivityForResult(Activity.java:3806)
                                                                                            at android.app.Activity.startActivityForResult(Activity.java:3767)
                                                                                            at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:855)
                                                                                            at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:907)
                                                                                            at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:927)
                                                                                            at com.example.android.directoryselection.DirectorySelectionFragment$1.onClick(DirectorySelectionFragment.java:95)
                                                                                            at android.view.View.performClick(View.java:4788)
                                                                                            at android.view.View$PerformClick.run(View.java:19911)
                                                                                            at android.os.Handler.handleCallback(Handler.java:739)
                                                                                            at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                            at android.os.Looper.loop(Looper.java:135)
                                                                                            at android.app.ActivityThread.main(ActivityThread.java:5275)
                                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                                            at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:910)
                                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:705)

caused on

                         startActivityForResult(intent, REQUEST_CODE_OPEN_DIRECTORY);
keyboardsurfer commented 9 years ago

The device you're testing with does not have an app to handle the fired intent. Since this is a development sample to show the general contract of this API, catching the exception here would do more harm than good. In a production app, a developer should implement fail-safe methods against this problem.