0

I have array list of integer that i want to add in one column of sqlite database,

I do this by contentValues like this:

contentValues.put(Tag.REPORT_LATITUDE_LIST, report.getLatitudes());

first! what is the type of this column in database table?

and

how can I get these arrayList data from sqlite?

1 Answer 1

3

You could serialize your object to JSON, store it in this format as a string and just deserialize it when you read it.

 contentValues.put(Tag.REPORT_LATITUDE_LIST, new Gson().toJson(report.getLatitudes()));

You would need to add Gson to your gradle dependencies.

dependencies {
implementation 'com.google.code.gson:gson:2.8.5'

}

Sign up to request clarification or add additional context in comments.

1 Comment

It'll be stored as a string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.