优艾设计网

eclipse 提示 ContextCompat中不包含checkSelfPermission方法?

优艾设计网 https://www.uibq.com 2023-02-17 07:48 出处:网络 作者:PS抠图
如图 import android.support.v4.app.ActivityCompat优艾设计网_设计圈;import android.support.v4.content.ContextCompat; 代码如下 private void requestPermission(String permission){ if(Build.VERSION.SDK_INT

如图

import android.support.v4.app.ActivityCompat优艾设计网_设计圈;
import android.support.v4.content.ContextCompat;

代码如下

private void requestPermission(String permission){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ if (ContextCompat.checkSelfPermission(BookListActivity.this,Manifest.permission.READ_EXTERNAL_STORAGE)         != PackageManager.PERMISSION_GRANTED) {        ActivityCompat.requestPermissions(BookListActivity.this,                 new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},                 MY_PERMISSIONS_REQUEST_READ_CONTACTS);} } }


0

精彩评论

暂无评论...
验证码 换一张
取 消