onRequestPermissionsResult not being called in fragment if defined in both fragment and activity

前端 未结 15 1327
余生分开走
余生分开走 2020-11-28 22:14

I have a fragment in which I have recyclerview and setting data in this recyclerview using recyclerview adapter.

Now, I am having a button in the adapter\'s list ite

15条回答
  •  执笔经年
    2020-11-28 22:40

    The method requestPermissions on Fragments requires API level 23 or higher.
    If your app targets a lower version you can use

    FragmentCompat.requestPermissions(this,
                new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                ConstantVariables.READ_EXTERNAL_STORAGE);
    

    First you need to add the support-v13 dependency:

    implementation "com.android.support:support-v13:$supportLibVersion"
    

提交回复
热议问题