Open fabdurso opened 4 years ago
@WindSekirun @deepakkumardk ever seen this?
@thefabbulus Is this happening every time or just a one time crash. This could happen when you use restart activity or apply changes options.
@deepakkumardk always.
@deepakkumardk noticed that this is only happening on a real device, and not happening on a virtual device.
NaraeImagePicker.instance.start(
ActivityUtils.getTopActivity(), pickerOption,
object : OnPickResultListener {
override fun onSelect(resultCode: Int, imageList: ArrayList<String>) {
if (resultCode != NaraeImagePicker.PICK_SUCCESS) {
single.onError(Error("Operation canceled!"))
} else {
single.onSuccess(imageList.map { File(it) })
}
}
}
)
@thefabbulus could you please provide the implementation of ActivityUtils.getTopActivity() and pickerOption.
@deepakkumardk
public static Activity getTopActivity() {
return Utils.getActivityLifecycle().getTopActivity();
}
val pickerOption = PickerSettingItem().apply {
pickLimit = 3
viewMode = ViewMode.FolderView
enableDetailMode = true
uiSetting.enableUpInParentView = true
}
@thefabbulus @deepakkumardk
Sorry, I can't check this issue because notifications doesn't delivered.
Probably, I guess the implementation of getActivityLifecycle()
is the problem.
Can you tell me why you are using getActivityLifecycle()
instead of this
?
@thefabbulus Are you using some library for getTopActivity(). Please, mention the library too. Most probably this could be the cause of the error. To fix the issue try to use fragment/activity context or applicationcontext, if this happens again let me know. I will update this thread on this issue.
@deepakkumardk weird since it was working good until last week.
Activity getTopActivity() {
if (!mActivityList.isEmpty()) {
for (int i = mActivityList.size() - 1; i >= 0; i--) {
Activity activity = mActivityList.get(i);
if (activity == null || activity.isFinishing() || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed())) {
continue;
}
return activity;
}
}
Activity topActivityByReflect = getTopActivityByReflect();
if (topActivityByReflect != null) {
setTopActivity(topActivityByReflect);
}
return topActivityByReflect;
}
@thefabbulus I have tested the app with library AndroidUtilCode's (v1.26.0) method getTopActivity() with one activity stack (without any fragment, what's your scenario) and it's working fine in my real device.
@deepakkumardk here is a screenshot of the crash report
@sagar-docterz could you please provide the sample code that you are using to start the Picker.
Was not happening until a few days ago.
Gradle version: 3.6.0