Please see this example when i am taking small file then it works but when taking large video size with 1gb approx then outofmemory error
import java.io.*; public class ReadFileByteArray { public static void main(String[] args) { //create file object File file = new File("C://FileIO//ReadString.txt"); try { //create FileInputStream object FileInputStream fin = new FileInputStream(file); /* * Create byte array large enough to hold the content of the file. * Use File.length to determine size of the file in bytes. */ byte fileContent[] = new byte[(int)file.length()]; /* * To read content of the file in byte array, use * int read(byte[] byteArray) method of java FileInputStream class. * */ fin.read(fileContent); //create string from byte array String strFileContent = new String(fileContent); System.out.println("File content : "); System.out.println(strFileContent); } catch(FileNotFoundException e) { System.out.println("File not found" + e); } catch(IOException ioe) { System.out.println("Exception while reading the file " + ioe); } } } /* Output would be File content : This file is for demonstration of how to read file in byte array using Java FileInputStream. */ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en