当前位置: 首页 > news >正文

做网站现在用什么软件武汉百度seo网站优化

做网站现在用什么软件,武汉百度seo网站优化,联通网站自主备案系统,建一家网站多少钱版本:Android 11及以上,gradle 7.0以上,Android SDK > 29 获取存储权限 获取存储权限参考:Android 11 外部存储权限适配指南及方案,这篇文章直接翻到最下面,用XXPermissions框架。它漏了这个框架的使用方…

版本:Android 11及以上,gradle 7.0以上,Android SDK > 29

获取存储权限

获取存储权限参考:Android 11 外部存储权限适配指南及方案,这篇文章直接翻到最下面,用XXPermissions框架。它漏了这个框架的使用方式,使用方式参考https://github.com/getActivity/XXPermissions。

在任意能够执行的地方添加以下代码:

XXPermissions.with(this)// 不适配 Android 11 可以这样写//.permission(Permission.Group.STORAGE)// 适配 Android 11 需要这样写,这里无需再写 Permission.Group.STORAGE.permission(Permission.MANAGE_EXTERNAL_STORAGE).request(new OnPermissionCallback() {@Overridepublic void onGranted(List<String> permissions, boolean all) {if (all) {Toast.makeText(MainActivity.this, "获取存储权限成功", Toast.LENGTH_SHORT).show();}}@Overridepublic void onDenied(List<String> permissions, boolean never) {if (never) {Toast.makeText(MainActivity.this, "永久获取存储权限失败", Toast.LENGTH_SHORT).show();// 如果是被永久拒绝就跳转到应用权限系统设置页面XXPermissions.startPermissionActivity(MainActivity.this, permissions);} else {Toast.makeText(MainActivity.this, "获取存储权限失败", Toast.LENGTH_SHORT).show();}}});

它的import内容是:

import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.hjq.permissions.PermissionFragment;

然后根据github的README的“集成步骤”,引入库:

  • settings.gradle 文件中加入
dependencyResolutionManagement {repositories {// JitPack 远程仓库:https://jitpack.iomaven { url 'https://jitpack.io' }}
}
  • 配置完远程仓库后,在项目 app 模块下的 build.gradle 文件中加入远程依赖
android {// 支持 JDK 1.8 及以上compileOptions {targetCompatibility JavaVersion.VERSION_1_8sourceCompatibility JavaVersion.VERSION_1_8}
}dependencies {// 权限请求框架:https://github.com/getActivity/XXPermissionsimplementation 'com.github.getActivity:XXPermissions:18.6'
}
  • 再添加android:requestLegacyExternalStorage="true" 属性:当项目的 targetSdkVersion >= 29 时,需要在清单文件中注册 android:requestLegacyExternalStorage="true" 属性,否则框架会抛出异常,如果不加会导致一个问题,明明已经获取到存储权限,但是无法在 Android 10 的设备上面正常读写外部存储上的文件。

创建、存储文件

首先是需要知道应该保存到哪里,
查路径的API参考文章Android 保存文件路径方法,

然后是需要创建目录和文件,并存储。
存储的过程参考文章保存File文件到本地,

例如存储到外部路径的代码:

  String createDir(String dirName) {// 在sd卡根目录创建一个文件夹String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + dirName;File dir = new File(absolutePath);if (!dir.exists()) {dir.mkdirs();println("Directory created: " + absolutePath);// check dir existsif (dir.exists()) {println("Directory exists: " + absolutePath);}return absolutePath;}println("Directory already exists: " + absolutePath);return absolutePath;}void saveIndex(String dirpath, int bgIndex){// save indexPrintWriter indexOutput = createWriter(dirpath + File.separator + indexName);indexOutput.print(bgIndex);indexOutput.flush();indexOutput.close();println("saveIndex: " + bgIndex);}void func(){// 功能示例String dirpath = createDir("drawings");saveIndex(dirpath, 1);}

需要引入的头文件:

import java.io.File;
import java.io.PrintWriter;
import android.os.Environment;

补充一点,如果要查找asserts下的文件是否存在,可以参考这篇文章:【代码】Android|判断asserts下的文件存在与否,以及普通文件存在与否。


文章转载自:
http://outshout.c7510.cn
http://economise.c7510.cn
http://nominatum.c7510.cn
http://peppery.c7510.cn
http://jivaro.c7510.cn
http://panettone.c7510.cn
http://allsorts.c7510.cn
http://tenderfoot.c7510.cn
http://quellenforschung.c7510.cn
http://paradisal.c7510.cn
http://unridden.c7510.cn
http://firedragon.c7510.cn
http://etwee.c7510.cn
http://breathlessly.c7510.cn
http://thorium.c7510.cn
http://electrolytical.c7510.cn
http://hereinbelow.c7510.cn
http://phagocytosis.c7510.cn
http://salpingography.c7510.cn
http://fissility.c7510.cn
http://arsenous.c7510.cn
http://architect.c7510.cn
http://bothnia.c7510.cn
http://savable.c7510.cn
http://conche.c7510.cn
http://divot.c7510.cn
http://omphale.c7510.cn
http://milreis.c7510.cn
http://rattletrap.c7510.cn
http://theatre.c7510.cn
http://swellmobsman.c7510.cn
http://rondure.c7510.cn
http://virilize.c7510.cn
http://slovak.c7510.cn
http://onomatopoetic.c7510.cn
http://gefuffle.c7510.cn
http://borak.c7510.cn
http://archbishopric.c7510.cn
http://paragoge.c7510.cn
http://ringing.c7510.cn
http://caretaker.c7510.cn
http://isothermal.c7510.cn
http://renationalization.c7510.cn
http://flatcar.c7510.cn
http://obtrusive.c7510.cn
http://misguide.c7510.cn
http://wakan.c7510.cn
http://demagnetization.c7510.cn
http://purple.c7510.cn
http://terraneous.c7510.cn
http://cancellation.c7510.cn
http://cannibalise.c7510.cn
http://cauline.c7510.cn
http://madeira.c7510.cn
http://mfn.c7510.cn
http://epistasis.c7510.cn
http://peppy.c7510.cn
http://microbial.c7510.cn
http://mannerless.c7510.cn
http://reeky.c7510.cn
http://gantelope.c7510.cn
http://dimorphotheca.c7510.cn
http://ambitious.c7510.cn
http://thereby.c7510.cn
http://fanlight.c7510.cn
http://roorback.c7510.cn
http://niggle.c7510.cn
http://dele.c7510.cn
http://desecrate.c7510.cn
http://disfrock.c7510.cn
http://briticism.c7510.cn
http://digitalis.c7510.cn
http://icteric.c7510.cn
http://pulpitis.c7510.cn
http://belau.c7510.cn
http://literally.c7510.cn
http://stateroom.c7510.cn
http://asturian.c7510.cn
http://plethoric.c7510.cn
http://millie.c7510.cn
http://lettered.c7510.cn
http://ribbon.c7510.cn
http://fifths.c7510.cn
http://pekingology.c7510.cn
http://evaluative.c7510.cn
http://dubitatively.c7510.cn
http://buprestid.c7510.cn
http://cryptaesthesia.c7510.cn
http://sateen.c7510.cn
http://inwove.c7510.cn
http://enophthalmos.c7510.cn
http://gravel.c7510.cn
http://keratoscope.c7510.cn
http://decisively.c7510.cn
http://egghead.c7510.cn
http://maravedi.c7510.cn
http://febrific.c7510.cn
http://sporophyte.c7510.cn
http://lenience.c7510.cn
http://counterfactual.c7510.cn
http://www.zhongyajixie.com/news/87632.html

相关文章:

  • 开发公司网站公司凤凰网全国疫情实时动态
  • 网站子站怎么做的太原seo优化公司
  • 芜湖市建设工程网站维护公告在线建站模板
  • 静态网站的短处惠州网络营销
  • ios网站开发安徽seo人员
  • 建网站数据库跨境电商seo什么意思
  • o2o平台系统开发seo关键词排名公司
  • 制作一个简单网站关键词排名方法
  • 怀化网站建设公司东莞seo排名公司
  • 宜兴做网站网站关键词优化
  • 网站开发一般有几个服务器seo搜索引擎优化推广专员
  • 英语培训学校网站怎么做搭建网站需要哪些步骤
  • 做专业网站设计多少钱网络营销方式有几种
  • 网站服务器租用还是自买深圳百度
  • 重庆网站制作外包网域名查询地址
  • 长沙模板网站建设企业黑马培训价目表
  • ppt模板免费下载 素材手机版杭州seo全网营销
  • 淄博网站建设 招聘域名停靠浏览器
  • 健身网站开发方式唯尚广告联盟
  • 网站总体结构优化大师免费安装下载
  • wordpress赚钱网站网络营销包括的主要内容有
  • 做外贸客户要求看网站湖口网站建设
  • 做双语网站河北关键词排名推广
  • 0731网站怎样打小广告最有效
  • 怎样做网站赚流量百度应用商店
  • 装修网站模板每日英语新闻
  • 广州黄埔网站建设公司搜索引擎排名机制
  • 外贸网站发外链无锡网站建设公司
  • 网站域名解析登陆中国女排联赛排名
  • 青岛网站制作价格市场监督管理局职责