Hi I am trying to make an app using view pager with two fragments one fragment for camera and second fragment for contact List which requires permissions for accessing contact lists and camera.When I am installing its apk My Application is crashing.There is some problem in fetching permission from the users kindly have a look at my code and error and please suggest a solution.I am sharing code for Contacts and camera fragment.I am requesting for permissions in there particular fragments.
This is Camera Fragment
Thanks this problem is sorted but getting some other problem in camera fragment the app is launching I get the options for accessing contacts and external storage.but permission for camera is not asked at this time.But if I again open the app then permission for camera is asked.I mean to say all three permissions(Contacts,Camera,External Storage )is not asked at the same time.When my app opens Contacts Fragment is shown.And I am not getting any stack trace also.
Tim Moores wrote:Check which permissions the app has. Sometimes reinstalling the app via USB removes them, but not always in my experience.
In Manifest I have declared all the permissions it's just requestPermission method is getting called two times 1. In Contacts fragment(for contacts permission) 2. in Camera Fragment (for camera permission) so when the app in launching for the first time then Contacts Fragments get's opened so I think so app only asks for permissions required for contacts Fragments.But again when app is opened then it definitely asks for permission for camera also.How to fix this?