Exposed

android.os.FileUriExposedException:file:///storage/emulated/0/test.txt通过Intent.getData()在应用程序之外公开

守給你的承諾、 提交于 2020-05-03 16:09:10
问题: The app is crashing when I'm trying to open a file. 当我尝试打开文件时,应用程序崩溃。 It works below Android Nougat, but on Android Nougat it crashes. 它在Android Nougat以下运行,但是在Android Nougat上崩溃。 It only crashes when I try to open a file from the SD card, not from the system partition. 仅当我尝试从SD卡而不是系统分区打开文件时,它才会崩溃。 Some permission problem? 一些权限问题? Sample code: 样例代码: File file = new File("/storage/emulated/0/test.txt"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "text/*"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); // Crashes on this

An Introduction to OAuth 2

瘦欲@ 提交于 2020-04-28 03:24:58
Posted July 21, 2014 1.1m views SECURITY API CONCEPTUAL Mitchell Anicas Introduction OAuth 2 is an authorization framework that enables applications to obtain limited access to user accounts on an HTTP service, such as Facebook, GitHub, and DigitalOcean. It works by delegating user authentication to the service that hosts the user account, and authorizing third-party applications to access the user account. OAuth 2 provides authorization flows for web and desktop applications, and mobile devices. This informational guide is geared towards application developers, and provides an overview of

Bootstrap Tags Input标签输入插件

元气小坏坏 提交于 2020-04-26 22:51:30
Examples Markup Just add data-role="tagsinput" to your input field to automatically change it to a tags input field. Amsterdam Washington Sydney Beijing Cairo Show code statement returns $("input").val() $("input").tagsinput('items') True multi value Use a <select multiple /> as your input element for a tags input, to gain true multivalue support. Instead of a comma separated string, the values will be set in an array. Existing <option /> elements will automatically be set as tags. This makes it also possible to create tags containing a comma. Amsterdam Washington Sydney Beijing Cairo Show

安卓打开相机相册功能实现,并通过SpringBoot对接Retrofit2上传图片(@RequestBody转变为MultiPartFile全流程,低门槛实现系列)

空扰寡人 提交于 2020-04-26 15:55:09
需求分析: 通过安卓打开相机相册,使用SSM框架搭建后台接口,前端使用retrofit2进行文件传输 注:低门槛实现系列就是不涉及过深的知识点,不做过多的异常捕获,不过滤版本不判空,面向小白。 正文 首先需要搭建SSM框架,默认你已经学会了,相应的接口可以看看下面这一篇文章 https://blog.csdn.net/qq_44403367/article/details/105690838 @Controller @ResponseBody @RequestMapping ( "Oss" ) public class OssController { @Autowired private OssService ossService ; @ApiOperation ( value = "文件上传" , notes = "文件上传" ) @ResponseBody @RequestMapping ( value = "/uploadImage" , method = RequestMethod . POST , consumes = "multipart/*" , headers = "Content-Type=multipart/form-data" ) public BaseModel upload ( @ApiParam ( "商品id" ) @RequestParam (

函数式编程与面向对象编程[关闭]

╄→гoц情女王★ 提交于 2020-04-26 11:03:30
问题: I've been mainly exposed to OO programming so far and am looking forward to learning a functional language. 到目前为止,我已经主要接触过OO编程,并期待学习一门函数式语言。 My questions are: 我的问题是: When do you choose functional programming over object-oriented? 什么时候选择面向对象的函数式编程? What are the typical problem definitions where functional programming is a better choice? 什么是典型的问题定义,其中函数式编程是更好的选择? 解决方案: 参考一: https://stackoom.com/question/8ipu/函数式编程与面向对象编程-关闭 参考二: https://oldbug.net/q/8ipu/Functional-programming-vs-Object-Oriented-programming-closed 来源: oschina 链接: https://my.oschina.net/u/3797416/blog/4253767

java反射调用get/set方法,你还在拼接方法名吗?

别等时光非礼了梦想. 提交于 2020-04-25 02:02:20
前言 最新工作中,遇到了通过反射调用get/set方法的地方,虽然反射的性能不是很好,但是相比较于硬编码的不易扩展,getDeclareFields可以拿到所有的成员变量,后续添加或删除成员变量时,不用修改代码,且应用次数只在修改数据时使用,故牺牲一些性能提高扩展性 传统的方式 见过很多人通过反射调用get/set方法都是通过获取属性的name,然后通过字符串截取将首字母大写,再拼上get/set来做 String fieldName = field.getName(); String getMethodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); 还有稍微好一点的同学,通过fieldName转成字符数组,首个字符-32来避免字符串截取的 String fieldName = field.getName(); char [] chars = fieldName.toCharArray(); chars[ 0] = ( char )(chars[0] - 32 ); String getMethodName = "get" + new String(chars); 诚然,我觉得两种方式都可以,但是不知道有没有遇到过,生成的get/set方法并不是已get/set开头的

为什么取不到metamask的账号?

流过昼夜 提交于 2020-03-02 09:13:42
当你使用Metamask测试以太坊DApp时,如果出现莫名其妙的问题,检查一下web3.eth.accounts是否可以获取到账户,如果不能获取的话,那么最大的可能是你使用了新版的Metamask,并且默认启用了隐私模式。 有两种办法来让你的DApp可以正常访问Metamask管理的账户:关闭隐私模式,或者修改JavaScript代码使其兼容Metamask的隐私模式。 一、关闭隐私模式 在metamask中首先进入设置,然后点击 security & privacy , 在隐私模式菜单,选择 关闭隐私模式 即可: 二、兼容隐私模式 在2018年11月,Metamask刚引入隐私模式时,该选项默认是关闭的。但是在 最新的版本中,已经默认开启了隐私模式。要求每个用户都手动关闭隐私模式 是不现实的,因此更好的方案是修改我们的JavaScript代码来兼容隐私模式: window.addEventListener('load', async () => { // Modern dapp browsers... if (window.ethereum) { window.web3 = new Web3(ethereum); try { // Request account access if needed await ethereum.enable(); // Acccounts now