yayaa / LocationManager

Simplify getting user's location for Android
807 stars 187 forks source link

Doesn't work from a bottomsheetfragment if it needs to request permission #10

Closed ncapdevi closed 7 years ago

ncapdevi commented 8 years ago

When it tries to request permissions, nothings shows up, and the window is leaked

E/WindowManager: android.view.WindowLeaked: Activity com.XXXXX.main.MainActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{5864a01 V.E...... R....... 0,0-1440,526} that was originally added here
                                                                      at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
                                                                      at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
                                                                      at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
                                                                      at android.app.Dialog.show(Dialog.java:319)
                                                                      at com.yayandroid.locationmanager.helper.PermissionManager.requestPermissions(PermissionManager.java:93)
                                                                      at com.yayandroid.locationmanager.helper.PermissionManager.requestPermissions(PermissionManager.java:63)
                                                                      at com.yayandroid.locationmanager.LocationManager.askForPermission(LocationManager.java:265)
                                                                      at com.yayandroid.locationmanager.LocationManager.get(LocationManager.java:210)
                                                                      at com.yayandroid.locationmanager.LocationManager.get(LocationManager.java:182)
yayaa commented 8 years ago

Do you mean 'BottomSheetDialogFragment' ? And what context are you passing into?

ncapdevi commented 8 years ago

Sorry, yes BottomSheetDialogFragment .I'm passing in the Activity's context using locationManager.on(getActivity());

yayaa commented 8 years ago

Sorry, i was kind of busy at last days. "Window is leaked" might also be happened when you had a crash while you are displaying the dialog, it doesn't need to be the main problem, and in most cases it is actually not. So can you please check the logcat again, and tell me if you see any other crash results beside that one, if so please inform me, so that i can help you with. @ncapdevi