当前位置:网站首页>Encountered.Sqlite file processing during Android Development
Encountered.Sqlite file processing during Android Development
2022-07-28 17:23:00 【version1_ 0】
Provide an idea , A little bit of a problem , Who told me to cook
1. download navicat for premium, It's the software of yellow cat's head .
2. Establish a new connection to SQLite.

3. Open the table and Export , The export format is .json.

4. stay as Created in assets Folder , take .json Copy and paste the file .

5. Read through the stream where needed .
6. adopt gson Analyze and save to list aggregate .
7. If you need to find a value , Build a map aggregate , Traverse list aggregate , Set the value used to find to 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(" Read json The data in the file ", 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(" Read json File error prompt ", e.toString());
}
}
}).start();
}边栏推荐
- Learn about service discovery in kubernetes
- The practice of beego framework developed by goweb: Section 4 database configuration and connection
- Games101 section 13 ray tracing notes
- Goweb开发之Beego框架实战:第一节 Beego框架介绍
- Why do I choose to use go language?
- Function接口之andThen
- Algorithm learning: leetcode interview question 09. implement queue with two stacks
- The longest substring of sword finger offer without repeated characters
- Mysql database addition, deletion, modification and query (detailed explanation of basic operation commands)
- Vscode界面介绍
猜你喜欢

22年多校第三场(F的证明

valarray数值库学习

如何在构建阶段保护镜像安全

Unity shader realizes mirror effect with rendered texture

Why do I choose to use go language?

Visual Studio 2012/2015发布Web应用连同.cs源码一起发布

Use of influxdb2

Jupyter notebook win installation record

Unity shader global fog effect

Visual studio 2012/2015 releases web applications together with.Cs source code
随机推荐
UNIQUE VISION Programming Contest 2022(AtCoder Beginner Contest 248)G. GCD cost on the tree
Codeforces round 770 (Div. 2) F. Fibonacci additions (construction + difference)
Using SQL server agent job to restore the database regularly
WPF command button transparent style
《Kubernetes》你需要掌握的 Service 和 Ingress
Analysis of kubernetes service principle
The actual combat of the beego framework of goweb development: Section III program execution process analysis
Azure Devops developed by visual studio 2015 team
List of supplementary questions
总数据量超万亿行,玉溪卷烟厂通过正确选择时序数据库轻松应对
Learn about service discovery in kubernetes
侦察机与预警机的区别
Verilog 每日一题 (VL27 可置位计数器)
Use Alibaba cloud's free SSL certificate
GEAR: Graph-based Evidence Aggregating and Reasoning for Fact Verification
Selection and application of inductors in high speed circuits
Unity shader screen post-processing
Goweb开发之Beego框架实战:第四节 数据库配置及连接
2022 Niuke multi school second CDE
C# 导入Excel文件数据的几种方法