按时间
按收藏关键字
按分类
1.JAVA基础
1.1 java基础io流——OutputStream和InputStream的故事(温故知新)
重点介绍了 write read的两种形式,并加入了BufferedOutputStream和BufferedInputStream,重写了copy file。
对应的链接
1.2 内存操作流ByteArrayOutputStream
ByteArrayOutputStream bos = new ByteArrayOutputStream();
// 写数据
for (int x = 0; x < 10; x++) {
bos.write((“hello” + x).getBytes());
}
byte[] bytes = bos.toByteArray();
内存操作流ByteArrayOutputStream,CharArrayWriter, StringWriter
2.下载文档
2.1 OKhttp 下载文件
安卓最简单的文件下载, 基于OkHttp,包含下载进度、断点续传
OkHttp官方教程解析-彻底入门OkHttp使用
问题点1:
3.更新软件
3.1 Android 轻松实现后台搭建+APP版本更新
[地址](https://blog.youkuaiyun.com/u012422829/article/details/46355515)
point1 :下载文件部分,采用了HttpClient,目前不太友好
void downFile(final String url) {
point2:SD卡存储-----目前不太友好
if (is != null) {
File file = new File(
Environment.getExternalStorageDirectory(),
"Test.apk");
fileOutputStream = new FileOutputStream(file);
point3: 安装文件的固定写法,采用setDataAndType(Uri.fromFile,目前不太友好。
//安装文件,一般固定写法
void update() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment
.getExternalStorageDirectory(), "Test.apk")),
"application/vnd.android.package-archive");
startActivity(intent);
}
安装文件,其他博客的建议为
[cnblogs的建议](https://www.cnblogs.com/kongxiaoshuang/p/5996358.html)
private void openFile(File file) {
// TODO Auto-generated method stub
Log.e("OpenFile", file.getName());
Intent intent = new Intent();
**intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);**
intent.setDataAndType(Uri.fromFile(file),
"application/vnd.android.package-archive");
startActivity(intent);
}
3.2 Android实现app内部自动检测版本更新、自动安装及数据库更新升级
https://blog.youkuaiyun.com/Nirvana_lss/article/details/89879571