当前位置:网站首页>在android开发过程中遇到.sqlite文件处理
在android开发过程中遇到.sqlite文件处理
2022-07-28 16:22:00 【version1_0】
提供一个思路,有点麻烦,谁让我菜呢
1.下载navicat for premium,就是黄色猫头的那个软件。
2.建立新的连接到SQLite。

3.打开表之后进行导出,导出格式为 .json。

4.在as里创建assets文件夹,将.json文件复制粘贴进去。

5.在需要的地方通过流进行读取。
6.通过gson进行解析存到list集合。
7.如果需要通过某一个值来查找的话,建立一个map集合,遍历list集合,把用来查找的那个值设置为key。
new Thread(new Runnable() {
@Override
public void run() {
try {
InputStreamReader isr = new InputStreamReader(getActivity().getAssets().open("place.json"), "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line;
StringBuilder builder = new StringBuilder();
while ((line = br.readLine()) != null) {
builder.append(line);
}
br.close();
isr.close();
Log.e("读取json文件里面的数据", builder.toString());
Gson gson = new Gson();
bean = gson.fromJson(builder.toString(), xx.class);
Map map = new HashMap();
for (int i = 0; i < bean.RECORDS.size(); i++) {
xx a = bean.RECORDS.get(i);
map.put(a.xx, a);
}
handler.sendEmptyMessage(1);
} catch (Exception e) {
e.printStackTrace();
Log.e("读取json文件错误提示", e.toString());
}
}
}).start();
}边栏推荐
- Jupyter notebook win installation record
- Modeling Semantics with Gated Graph Neural Networks for KBQA
- 零基础利用Unity3D开发AR应用并远程下载3D模型
- 配置V530交换机步骤
- : No such file or directory
- SUSE CEPH add nodes, reduce nodes, delete OSD disks and other operations – storage6
- Android Development - set cache
- SUSE Storage6 环境搭建详细步骤 – Win10 + VMware WorkStation
- 解决SQL Server数据库独占的问题
- Re12: read these3 semantic self segmentation for abstract summary of long legal documents in low
猜你喜欢

Goweb开发之Beego框架实战:第三节 程序执行流程分析

Ugui learning notes (II) Scrollview related

The 16th program design competition of Dalian University of Technology (Problem Solver)

Add differential pairs and connections in Ad

全链路灰度在数据库上我们是怎么做的?

HTAP comes at a price

influxdb2的使用

Re12: read these3 semantic self segmentation for abstract summary of long legal documents in low

Re10: are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr

Unity shader realizes water wave effect with noise texture
随机推荐
Goweb开发之Beego框架实战:第四节 数据库配置及连接
kubernetes service 原理解析
Learn about service discovery in kubernetes
Unity shader texture animation
Unity shader global fog effect
Goweb开发之Beego框架实战:第五节 项目搭建及注册用户
Codeforces round 768 (Div. 2) e.paint the middle (greedy / interval relationship processing)
2021年4月份自考
Classroom attendance system based on QT design (using RDS for MySQL cloud database)
HTAP comes at a price
数据库故障容错之系统时钟故障
Exercise note 5 (square of ordered array)
Record the processing process of CEPH two RBDS that cannot be deleted
Problem solution of code heartstrings Junior Group (official competition) of Dalian University of Technology (Development Zone campus) in 2021
Global mobile communication base station market in 2019: Ericsson, Huawei and Nokia ranked in the top three
Hikvision responded to the impact of the 'US ban': there are options for the components currently used
Go language slow entry - process control statement
Goweb开发之Beego框架实战:第三节 程序执行流程分析
Leetcode 2022.04.10 China Merchants Bank special competition D. store promotion (DP)
Some notes on how unity objects move