我先与Kallite公司合作,我想在表格一栏中增加一个阵列清单,然后把数据作为阵列清单。 阵列清单是长者名单。 我已注意到,SQ有一个储存BLOBS的选择,但我认为,首先需要将阵列清单改成一个星号,然后才能将其储存在我的SQite数据库中。
如果有人能找到解决办法,如何将阵列清单储存到一个可得到极大赞赏的数据库中。 或者是否有其他选择可以拯救我的系列数据,即应考虑吗?
我先与Kallite公司合作,我想在表格一栏中增加一个阵列清单,然后把数据作为阵列清单。 阵列清单是长者名单。 我已注意到,SQ有一个储存BLOBS的选择,但我认为,首先需要将阵列清单改成一个星号,然后才能将其储存在我的SQite数据库中。
如果有人能找到解决办法,如何将阵列清单储存到一个可得到极大赞赏的数据库中。 或者是否有其他选择可以拯救我的系列数据,即应考虑吗?
插入:
ArrayList<String> inputArray=new ArrayList<String>();
/...。 投入的价值
Gson gson = new Gson();
String inputString= gson.toJson(inputArray);
System.out.println("inputString= " + inputString);
利用“投入String”来节省Lum数据库中的ArrayList的价值
反弹:
Get the String from the SQLiteDatabse what you saved and changed into ArrayList type like below: outputarray is a String which is get from SQLiteDatabase for this example.
Type type = new TypeToken<ArrayList<String>>() {}.getType();
ArrayList<String> finalOutputString = gson.fromJson(outputarray, type);
我有2个<代码>ArrayList<String>,这两个条目都将是1 000多个。 我看望博彩和tes,但对于我来说,通过改变插入方法和删除<代码>数据库,加快进程并使之可行的解决办法。 - “http://sagistech.blogspot.co.uk/2010/07/notes-on-android-sqlite-bukl-insert.html”
private static final String INSERT = "insert into "
+ YOUR_TABLE_NAME+ " (" + COLUMN_1 + ", "
+ COLUMN_2 + ") values (?, ?)";
public void insertArrayData(ArrayList<String> array1,
ArrayList<String> array2) {
try {
database.open();
} catch (SQLException e) {
e.printStackTrace();
}
int aSize = array1.size();
database.beginTransaction();
try {
SQLiteStatement insert = database.compileStatement(INSERT);
for (int i = 0; i < aSize; i++) {
insert.bindString(1, array1.get(i));
insert.bindString(2, array2.get(i));
insert.executeInsert();
}
database.setTransactionSuccessful();
} catch (SQLException e) {
e.printStackTrace();
} finally {
database.endTransaction();
}
try {
database.close();
} catch (Exception e) {
e.printStackTrace();
}
}
它易于适应长老和低温等,快速缓解。 因此,我很感谢的是,我竟然要把我的头部推倒在花旗上。 希望会有所助益。
There is an easier way that do such thing in completely another way. you can make an string that consists of all your array values. for that make an StringBuilder and append the values continuously and offcource with a separator (like a simbole you which you won t use in your array values . for example virtual | . in code for example :
double[] mylist = new double[]{23, 554, 55};
StringBuilder str = null;
str = new StringBuilder();
for(int i=0;i<mylist.length;i++){
str.append(mylist[i]+"|");
}
String result = str.toString();
db.open();
db.insert(result);
db.close();
当你想 them取这些价值观时。 从数据库中取出一栏,纯粹从数据库到Sting,而单列阵列中每个阵列数值的相左,可以轻易使用:
引文:
String str = db.getdata();
String[] list = str.split("|");
简单转换后,你可以将其用作双倍;
double mydouble = Double.parsDouble(list[1].toString());
也许这不是标准,而是有帮助的,希望有帮助。
您希望把名单编成序号:。 这里是Java Serialization AP的指南/内容。
你们不得不人工操作,处理名单上的每一项目,并在数据库中储存之前加以改动。
for (long l : array<long>){
//change to byte here
//Store in database here
}
ArrayList<String> list = new ArrayList<String>();
list.add("Item 1");
list.add("Item 2");
list.add("Item 3");
String joined = TextUtils.join(",", list);
Log.i(TAG, "joined strings: " + joined);
String[] array = TextUtils.split(joined, ",");
Log.i(TAG, "joined strings: " + array[0] + array[1] + array[2]);
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...