0

I am getting all the data in ArrayList<HashMap<String, String>>InfoList; and this data I want to store in SQLite database locally which will be used later by the application. All the data in ArrayList<HashMap<String, String>>InfoList; is coming from web server when the application starts. Please gudie me how to do the same. Thanks in advance.

2 Answers 2

1

If you want to insert it as a single object, you can use the class ObjectMapper ( u can download jackson-all-1.9.0.jar to use it), to transform your object to String like this :

ObjectMapper mapper = new ObjectMapper();
String stringToAddOnSQLITE = writeValueAsString( your object here );

then you save it on the database as a string. to transform the string to your object use this :

yourObject = mapper.readValue(stringToAddOnSQLITE , new TypeReference<YOUR OBJECT TYPE>() { });
Sign up to request clarification or add additional context in comments.

Comments

0

To store object data in Sqlite

1: Serialize your object

2: Store that object as BLOB Data in SQLITE

To retrieve object data from Sqlite

1: Get blob from Sqlite database

2: DeSerialize that blob in to your object

1 Comment

Thanks for the reply dhams. I'll try the way you have given.

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.