0

I'm newbie in android and I'm writing a transport scheduling android app.

I have a JSON data with a huge structure (time, bus stops list, train-stops list, routes, etc). The scheduling changes 2 times per year (summer and winter times).

To write my own API is too hard for me.

Can I store JSON data in SQLite or SharedPreferences? Or the best way to store in service like parse.com and than download it to device ? Or I can store it in the file?

Vadim L.
  • 157
  • 2
  • 14
  • you can store your json data as a string anywhere you want – Vivek Mishra Jan 05 '16 at 10:09
  • If you just store the JSON file and it is huge, it will be slow to access the information in it. Consider storing the information in the database. – Henry Jan 05 '16 at 10:12
  • You can store it in SQLite database and when it has to change update it through Parse. – Héctor Jan 05 '16 at 10:12
  • It all depends obviously on whether the data in question needs to be shared on multiple devices or not. – shyam Jan 05 '16 at 10:13
  • 1
    I am flagging to close this question as the answers to this will be **primarily opinion-based** – Ed Holloway-George Jan 05 '16 at 10:35
  • I agree with @EdGeorge - this is broad and opinion-based. And you can already see how each answer is just another opinion. There's no right answer to this. And if you're asking this type of question, then just shoving your JSON data into some suggested database you know nothing about is likely going to cause you additional problems. – David Makogon Jan 05 '16 at 12:19

2 Answers2

4

I will recommend, best way would be to parse the data at beginning. create required table in sqlite and dump the parsed data into sqlite database. Later you can query and fetch the required data from the sqlite database.

rahul
  • 1,095
  • 8
  • 22
  • `parse the data at beginning` How can I implement that if I have data localy in notepad ? – Vadim L. Jan 05 '16 at 10:51
  • You have Json data with huge structure. You can read the data from notepad, get all content in a String variable. and then you can parse it using JSON Parsing. Please refer following link to read a text file in android. http://stackoverflow.com/questions/12421814/how-can-i-read-a-text-file-in-android. Once you have obtained the String of Json data, you can do Json Parsing by converting the String to either JsonObject or JsonArray based on what you have in the text. Please refer following link for json parsing: http://stackoverflow.com/questions/8091051/how-to-parse-json-string-in-android – rahul Jan 05 '16 at 10:59
  • Ignoring, for a moment, that you're proposing an opinion to an opinion-soliciting question (which will likely be closed shortly), the last thing you want to do is start providing details to answers inside of comments. At a minimum, edit your answer. – David Makogon Jan 05 '16 at 12:20
  • ok I got it. Thanks, I will do it next time onwards. – rahul Jan 05 '16 at 12:23
0

I use RushOrm (http://www.rushorm.com/) to store easily all my data in the sqlite database :) Try it :)

Blunderer
  • 934
  • 7
  • 15