Skip to main content

Posts

Showing posts with the label android static data

save static data in android

In some situations you need to save the data for your android application statically. Which means you need to save the data during the design process of your android application. For example the information for the help topic, licence agreements for the application etc. So in this post i explain how to save data statically in android. Step 1: Create a new folder named " raw " under the " res " folder.  Step 2 : Create a text file of needed contents with file extension " .txt" and paste it in the " raw" folder. Step 3: Create an object of " InputStream " class with the " getResources() " and " openRawResources() " methods.    Example:                InputStream im = getResources().openRawResource(R.raw.myfile); Step 4: Obtain an object of " BufferedReader " class using the object of " InputStream ".   Example:                BufferedReader br = new ...