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.
Add a comment
|
2 Answers
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>() { });
Comments
To store object data in Sqlite
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
Mayur
Thanks for the reply dhams. I'll try the way you have given.