Reputation: 95
I am developing an application which creates menu with each menu item having its own icon. I have too many PNG files for each menu item. In future i will be updating menu items from WebService which will add to these png files.
What is the most efficient way to store this data(png files). I don't want to keep it in drawable folder as I can't update contents of drawable folder after i have shipped my app. If i am storing it on External Memory, How do i achieve that? Where exactly should i copy these png files and use them as resources in my code.
Thanks
Upvotes: 1
Views: 317
Reputation: 380
You can write to private space assigned to your app using this http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String, int) method and read back with it's sibling.
InputStream is = your input stream
OutputStream os = mContext.openFileOutput("image.png",Context.MODE_PRIVATE);
Utils.copyStream(is,os); //Your own steam copy here
is.close;
os.close;
Upvotes: 0