This is not a coding problem question, I just need general advice.
I am making an application that populates a listfragment with multiple text files. What I want is for the user to select the intended article they wish to read and said article will be provided for them. I have already made a master/detail esk application but it is only reading in a static array for the articles (which will later be changed to an expanding list and more dynamic method for reading in the files)
My question is this: do I make a database for the ~30-40 text files and create an onlistclick
--database adapter function or should I use Assetmanager
(or something else).
I am new to android programming and this is my first proper application so any suggestions that would be suitable for a novice would be much obliged.
If those text files are going to be modified very often then yes, it is a good idea to create a local database to keep them into.
On the other hand if you only need those 30-40 fixed text files and you are planning to add more just through app updates then you can simplify your life by using the assets folder. Cycle through all the files in there and use them to create the list.
Code snippet for Assets usage:
AssetManager assets = context.getAssets(); //use 'this' if you are inside an activity or 'getActivity()' if you are inside a fragment
String files[] = assets.list("folder_inside_assets"); //use assets.listFiles("folder"); if you want an array of File objects