I plan on making an app for a church, and it’s pretty much a relatively simple one, it’s just going to have a menu in the main xml which will contain an about section contact and a clips section. now when the user clicks on clips they will be redirected to an xml file listing all the audio clips for the services of prior weeks which the user can then click to listen to. i was just planning on creating a raw folder and placing all clips inside that folder and then accessing the audio files through the mediaplayer class with a raw. method, but would that really be the best way of doing it? I have several questions here. If i do it that way would I have to modify the code all of the time because i would have to insert the newest clips? if so what is a better way of doing this so i don’t have to continuously have to change my code each week since i plan on inserting the newest audio clip from that weeks service?
Share
Put all of your clips in the
assetsfolder.In your app use something like:
This returns a list of all files in assets folder. Here you need to use that array in a list view or handle it to create views in whatever way you find appropriate.
The easiest would be to use a listView and literally put the file titles in the list by using the array in the adapter.
When its time to use one of the files (perhaps in a
ListView.OnItemSelectedListener()):fileName is a string containing the name of the file you have selected.
This method will not involve changing code when it is time to update.
If your app is going to exceed 50mb you will need to use an expansion file. This is method is a bit more complicated due to the expansion file downloading and verifying, but it is used in a similar way.