title: Android : How to read file in bytes?
body: <p>I am trying to get file content in bytes in Android application. I have get the file in SD card now want to get the selected file in bytes. I googled but no such success. Please help</p>
  
  <p>Below is the code to get files with extension. Through this i get files and show in spinner. On file selection I want to get file in bytes.</p>
  
  <pre><code>private List&lt;String&gt; getListOfFiles(String path) {
  
     File files = new File(path);
  
     FileFilter filter = new FileFilter() {
  
        private final List&lt;String&gt; exts = Arrays.asList("jpeg", "jpg", "png", "bmp", "gif","mp3");
  
        public boolean accept(File pathname) {
           String ext;
           String path = pathname.getPath();
           ext = path.substring(path.lastIndexOf(".") + 1);
           return exts.contains(ext);
        }
     };
  
     final File [] filesFound = files.listFiles(filter);
     List&lt;String&gt; list = new ArrayList&lt;String&gt;();
     if (filesFound != null &amp;&amp; filesFound.length &gt; 0) {
        for (File file : filesFound) {
           list.add(file.getName());
        }
     }
     return list;
  }
  </code></pre>