A
A
Artix2015-02-22 21:04:43
Java
Artix, 2015-02-22 21:04:43

How to save to file and read HashMap in ANDROID?

Good day to all!
How can I save the List<Map<String, String>> (written in Russian, otherwise it will not be displayed) to a file, and then read it from there?
Thanks in advance for your replies

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nonrblGyN4ik, 2015-02-22
@nonrblGyN4ik

Alternatively, you can simply write to a file:

File file = new File(*ваши данные*);    
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(file));
outputStream.writeObject( yourObject );
outputStream.flush();
outputStream.close();

You can also convect to JSON and also save to a text file (although in your case, the first method will be easier)
Then read the JSON from the file and parse it into a List<>

L
lowolf, 2015-03-03
@lowolf

If the file is not large, then you can throw it into shared shares, as they wrote above, overtake it in json.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question