0

Bit of a n00b question but I plan on using jexcel for an android database I'm making to read from the file and make modifications of it. The excel file will be a part of the program (but will be editable through the app). My question is where do I keep this excel file (i have the initial database) in the eclipse projects file? Which folder?? Thanks.

Ahmed Zafar
  • 665
  • 2
  • 10
  • 24
  • 1
    You might want to consider using a SQLite database, as that is the standard for Android/built into the architecture. In my experience, third party libraries just bring tears and masochistic desires. – James Grammatikos Aug 15 '13 at 20:26
  • Haha elaborate more on tears and masochistic desires... You might be right but I'm on a deadline and for my simple purposes an excel sheet linked to an online google spreadsheet is the way to go. I will check out the SQLite database though thanks :) – Ahmed Zafar Aug 15 '13 at 20:42

1 Answers1

-2

Keep it in assets folder in Eclipse and it should work

BVdjV
  • 116
  • 1
  • 1
  • 11
  • Thanks, some people recommend assets, would that make a difference? – Ahmed Zafar Aug 15 '13 at 20:15
  • [link](http://developer.android.com/tools/projects/index.html) here's a link that can help you out. – BVdjV Aug 15 '13 at 20:17
  • Thanks! res\raw and assets don't seem to differ really. Also, if I keep my file in assets it would not be modifiable except in the way I allow my app user to do it right? I want to keep my app hack free... – Ahmed Zafar Aug 15 '13 at 20:23
  • Indeed. If you put the file in assets folder, you will be able to modify it only internally - in your app. For a hack-free solution I would recommend using this assets folder. If you want your database to be written from outside the app, res folder should work. – BVdjV Aug 15 '13 at 20:25
  • Don't do that. You can't modify files on assets/res/raw folders. You have to copy them somewhere else to be able to edit it. Changing those files will change the apk fingerprint, and your signature will be invalid (the app won't open after changing the file). Check jing's answer here http://stackoverflow.com/questions/3760626/how-to-write-files-to-assets-folder-or-raw-folder-in-android – Marcelo Aug 15 '13 at 20:33
  • It has to be editable from an online database that's the thing! Thank you Vlad anyway you have helped a lot. Things are clearer. Marcelo thanks I will check out the link ! :) – Ahmed Zafar Aug 15 '13 at 20:38
  • Anyway this answer is the correct one since I did not mention that the excel file will have to be updated. Marcelo thank you for introducing me to signature and their invalidity and stuff, currently looking at [link](http://developer.android.com/guide/topics/data/data-storage.html#filesInternal) :) – Ahmed Zafar Aug 15 '13 at 20:42
  • Well, you did mention that the excel "will be editable through the app", so i thought you would actually update the file. If that's not the case there's no problem. If you do need to edit the file, you can keep a "base file" on the assets folder, and copy it to your app sandbox when the user runs it for the first time - that's the "normal" approach for these situations. – Marcelo Aug 15 '13 at 22:09