android - onRequestPermissionsResult is not being called -
i want ask permission write external storage marshmallow
. can't see option override onrequestpermissionsresult
. able call requestpermissions
. have created below method. now, want call new action based on result. please me go ahead.
public static boolean verifypermissions(activity activity, string[] grantresults) { boolean allpermissionsgranted = true; if (build.version.sdk_int >= build.version_codes.m) { (string result : grantresults) { int outresult = activity.checkselfpermission(result); if (outresult != packagemanager.permission_granted) { allpermissionsgranted = false; break; } } if (!allpermissionsgranted) { activity.requestpermissions(grantresults, 1); } } return allpermissionsgranted; }
i have fragment
. tried below code directly showing error 'the method onrequestpermissionsresult(int, string[], int[]) of type products must override or implement supertype method'.
code :
@override public void onrequestpermissionsresult(int requestcode, @nonnull string[] permissions, @nonnull int[] grantresults) { }
i can't see option override onrequestpermissionsresult.
you override on activity
passing method.
Comments
Post a Comment