forrestguice / SuntimesWidget

Android app (and widget collection) that displays sunlight and moonlight times.
GNU General Public License v3.0
348 stars 61 forks source link

app crash when exporting alarms #612

Closed islam2hamy closed 2 years ago

islam2hamy commented 2 years ago
FATAL EXCEPTION: main
Process: com.forrestguice.suntimeswidget, PID: 3861
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.CREATE_DOCUMENT cat=[android.intent.category.OPENABLE] typ=text/plain flg=0x42 (has extras) }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1816)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
    at android.app.Activity.startActivityForResult(Activity.java:4398)
    at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
    at android.support.v4.app.ActivityCompatJB.startActivityForResult(ActivityCompatJB.java:30)
    at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:146)
    at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:937)
    at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:1047)
    at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:963)
    at android.support.v4.app.Fragment.startActivityForResult(Fragment.java:952)
    at com.forrestguice.suntimeswidget.alarmclock.ui.AlarmListDialog.exportAlarms(AlarmListDialog.java:519)
    at com.forrestguice.suntimeswidget.alarmclock.ui.AlarmListDialog.onOptionsItemSelected(AlarmListDialog.java:264)
    at android.support.v4.app.Fragment.performOptionsItemSelected(Fragment.java:2379)
    at android.support.v4.app.FragmentManagerImpl.dispatchOptionsItemSelected(FragmentManager.java:3133)
    at android.support.v4.app.FragmentController.dispatchOptionsItemSelected(FragmentController.java:344)
    at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:414)
    at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)
    at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113)
    at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113)
    at android.support.v7.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:69)
    at android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:206)
    at android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:776)
    at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
    at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156)
    at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:969)
    at android.support.v7.view.menu.MenuPopup.onItemClick(MenuPopup.java:127)
    at android.widget.AdapterView.performItemClick(AdapterView.java:310)
    at android.widget.AbsListView.performItemClick(AbsListView.java:1170)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3148)
    at android.widget.AbsListView$3.run(AbsListView.java:4063)
    at android.os.Handler.handleCallback(Handler.java:754)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:163)
    at android.app.ActivityThread.main(ActivityThread.java:6238)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
islam2hamy commented 2 years ago

com.android.documentsui is disabeld me.zhanghai.android.files is installed

( https://github.com/zhanghai/MaterialFiles )

forrestguice commented 2 years ago

Thanks for the report. It seems its not supported by MaterialFiles (issue 153).

I had assumed CREATE_DOCUMENT could always be resolved, but if its not available, I think the best we can do is fallback to ACTION_SEND and avoid the crash.