GitHub地址:https://github.com/yanzhenjie/AndPermission

这个库可以节省不少代码量和时间

使用示例如下

        findViewById(R.id.btnGetLocation).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AndPermission.with(HomeActivity.this).runtime().permission(Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION)
.onGranted(new Action<List<String>>() {
@Override
public void onAction(List<String> permissions) {
Log.d(TAG, "onAction(List<String>) called in onGranted, permissions: " + permissions);
}
})
.onDenied(new Action<List<String>>() {
@Override
public void onAction(List<String> data) {
Log.d(TAG, "onAction(List<String>) called in onDenied, data: " + data);
}
}).start();
}
});

Android笔记之权限库AndPermission的更多相关文章

  1. Android笔记——permission权限大全

    访问登记属性 android.permission.ACCESS_CHECKIN_PROPERTIES ,读取或写入登记check-in数据库属性表的权限 获取错略位置 android.permiss ...

  2. 59.Android开源项目及库 (转)

    转载 : https://github.com/Tim9Liu9/TimLiu-Android?hmsr=toutiao.io&utm_medium=toutiao.io&utm_so ...

  3. Android开源项目及库搜集

    TimLiu-Android 自己总结的Android开源项目及库. github排名 https://github.com/trending,github搜索:https://github.com/ ...

  4. Android 开源项目及库汇总(2)

    Android 开源项目及库汇总(2) ListenToCode 2.7 2018.10.10 15:43 字数 8527 阅读 1001评论 0喜欢 29 地图 百度地图– Android百度地图 ...

  5. ## Android 6.0 权限申请 ##

    Android 6.0 权限申请 1. 以前的权限申请(sdk<23) 直接在AndroidManifest.xml中申明即可: <uses-permission android:name ...

  6. Android图片加载库的理解

    前言     这是“基础自测”系列的第三篇文章,以Android开发需要熟悉的20个技术点为切入点,本篇重点讲讲Android中的ImageLoader这个库的一些理解,在Android上最让人头疼是 ...

  7. Android笔记——Android中数据的存储方式(二)

    我们在实际开发中,有的时候需要储存或者备份比较复杂的数据.这些数据的特点是,内容多.结构大,比如短信备份等.我们知道SharedPreferences和Files(文本文件)储存这种数据会非常的没有效 ...

  8. Android 6.0权限管理

    Android 6.0权限管理 关于权限管理 Android6.0 发布之后,Android 的权限系统被重新设计.在 23 之前 App 的权限只会在用户安装的时候询问一次,App一旦安装后就可以使 ...

  9. 毕加索的艺术——Picasso,一个强大的Android图片下载缓存库,OkHttpUtils的使用,二次封装PicassoUtils实现微信精选

    毕加索的艺术--Picasso,一个强大的Android图片下载缓存库,OkHttpUtils的使用,二次封装PicassoUtils实现微信精选 官网: http://square.github.i ...

随机推荐

  1. PHP连接MySQL报错"No such file or directory"的解决办法

    好下面说一下连接MYSQL数据库时报错的解决办法. 1,首先确定是mysql_connect()和mysql_pconnect()的问题,故障现象就是函数返回空,而mysql_error()返回“No ...

  2. git-版本管理工具的介绍+发展史+分布式版本控制系统和集中式版本控制系统的区别

    一.版本管理工具的介绍: 1.备份文件: 2.记录历史: 3.多端共享: 4.团队协作: 二.版本管理工具的发展史: 1.cvs: 集中式   1985: 2.svn:  集中式    2000: 3 ...

  3. js/jq仿window文件夹框选操作插件

    0.先给大家看看效果: 1.创建一个index.html文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ...

  4. 这道js面试题号称99%的人会做错

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. 【spring mvc】后台spring mvc接收List参数报错如下:org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.util.List]: Specified class is an interface

    后台spring mvc接收List参数报错如下:org.springframework.beans.BeanInstantiationException: Failed to instantiate ...

  6. Unable to connect to the MKS : Failed to connect to server XXXXXX:903

    Issue : 通过 vSphere 连接VM控制台的时候, 报错       Unable to connect to the MKS : Failed to connect to server X ...

  7. git extensions远程配置

    http://blog.csdn.net/pgmsoul/article/details/7860393 远程地址是如下格式:git@github.com:yaoname/project.git 保存 ...

  8. 第六讲_图像分割Image Segmentation

    第六讲_图像分割Image Segmentation 语义分割(semantic segmentation) 常用神经网络介绍对比-FCN SegNet U-net DeconvNet 目录 +三大数 ...

  9. CNN网络--VGGNet

    Simonyan, Karen, and Andrew Zisserman. "Very deep convolutional networks for large-scale image ...

  10. 【Scala类型系统】自身类型(self type)引用

    定义 特质能够要求混入它的类扩展自还有一个类型,可是当使用自身类型(self type)的声明来定义特质时(this: ClassName =>).这种特质仅仅能被混入给定类型的子类其中. 如果 ...