0

I'm developing an app that has an excel data-base in its assets folder. The app retrieves data from this excel file that's preloaded into the app. Thing is this file has to be updatable from an online server i.e. when I press a button called Update Database the app retrieves data from a file online and edits the excel file in the assets folder.

Problem is editing the file in the assets folder changes the app's signature and makes it unusable/non-executable. Is there a way around it? I could sandbox the file but I'm not sure how it works and android's openFileOutput(); seems to work with raw data rather than excel sheets.

Question is that is there a way around this problem? I want to be able to edit the excel database from an online service without making the android app's signature void. Thanks! PS: I'm a newbie so I need all the help I can get.

Ahmed Zafar
  • 665
  • 2
  • 10
  • 24

1 Answers1

1

Is there a way around it?

Copy the file to internal storage, then edit that copy.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • woah your rep's intimidating me:P okay, that's all well and good, but what happens when I want to retrieve the updated data. will it work by copying the file to internal storage? Foe example: I have a file stored in android, and if I want to retrieve information from it I copy it to internal storage and then get information from it? And then when I want to update information it's updated on the file that's stored in the storage and data is retrieved from that same file? And the initial file is pretty much unused now I guess? But I needed that initial file to load the initial database? – Ahmed Zafar Aug 15 '13 at 21:26
  • @AhmedZafar: "And the initial file is pretty much unused now I guess? But I needed that initial file to load the initial database?" -- correct. Consider the asset to merely be the source of your initial file contents, and perhaps the source of a recovery file should the one on internal storage somehow become corrupted (e.g., you crash while writing out to it). Note that you may wish to consider using some other data store (e.g., SQLite), with an export option to an Excel file. – CommonsWare Aug 15 '13 at 21:29
  • SQLite was recommended to me by another user as well but I'm new to this and on a deadline, I will definitely check it out though thanks so much! And just on a newbie note is it easier to use and free? SQLite? – Ahmed Zafar Aug 15 '13 at 21:32
  • @AhmedZafar: SQLite is integrated into Android. It is more flexible and reliable than working with tabular-style files directly, as it is a relational database. I cannot say whether it is easier, as I have no idea how difficult it is for you to be manipulating an Excel file. – CommonsWare Aug 15 '13 at 21:39
  • All right thanks this is definitely a push in the right direction! – Ahmed Zafar Aug 15 '13 at 21:42
  • I have one other question please. I want the program to copy the file from res\raw to internal storage just once, or if the file does not exist there already. If the file does exist of course it uses that file. How do I go on about implementing that? Thank you. – Ahmed Zafar Aug 16 '13 at 10:59