Android examples for App:Local Storage
Saves incident video to a local storage
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import android.content.Context; public class Main { /**//from w w w .jav a 2 s . c o m * Saves incident video to a local storage * @param data * @return File */ public static File saveIncidentVideo(Context context, byte[] data) { File myFile = new File(context.getFilesDir() + "/" + "incident_video.mp4"); myFile.setReadable(true, false); try { FileOutputStream fOut = context.openFileOutput( "incident_video.mp4", Context.MODE_WORLD_READABLE); fOut.write(data); fOut.flush(); fOut.close(); } catch (IOException e) { e.printStackTrace(); } return myFile; } }