title: READING EXTERNAL STORAGE ON ANDROID 4.2 JELLY BEAN
body: <p>Please Help....</p>
  
  <p>Ive created and App for Android 2.2 that creates a text file and saves to sd card.
  In another activity, it reads this file and stores into arrays.
  The App worked fine on 2.2, and worked perfectly well on my samsung nexus with 4.1. (ICS)
  However i have just updated to jelly bean (4.2) and the App now crashes when attempting to open the file.
  Ive read the documentation about adding read permission in the manifest for 4.2, and added this but the App still crashes. 
  No log cat as it works fine on emulator, but not on my phone.</p>
  
  <p>Are there any special permissions required for 4.2 or different way of opening files for reading?</p>
  
  <p>Here is my code for creating directory and writing file...</p>
  
  <pre><code> //Create Reports Folder...........................................
        File directory = new File 
        (Environment.getExternalStorageDirectory().getPath()+"/PatRecords");
                if (!directory.exists()) { 
                        directory.mkdir(); 
  
  
                        Toast.makeText(this, "NEW FOLDER CREATED", Toast.LENGTH_SHORT).show();
                } 
  
              //If Sd card available, and writable with no errors, then write file.........
              if ((mExternalStorageAvailable = true)&amp;(mExternalStorageWriteable = true)&amp;(Error==0))
                  {       
  
                  try {
                      File ReportFile = new File(directory.getPath()+"/"+FileName$);
                      ReportFile.createNewFile();
  
                      FileOutputStream fOut = new FileOutputStream(ReportFile);                   
                      OutputStreamWriter OutWriter = new OutputStreamWriter(fOut);
  
                      OutWriter.write(Tester$+"\r\n");
                      OutWriter.write(Company$+"\r\n");
                      OutWriter.write(Customer$+"\r\n");
                      OutWriter.write(Address1$+"\r\n");
                      OutWriter.write(Address2$+"\r\n");
                      OutWriter.write(PCode$+"\r\n");
                      OutWriter.write(Instr$+"\r\n");
                      OutWriter.write(Serial$+"\r\n");
  
                      OutWriter.close();
                      fOut.close();
  
                      Toast.makeText(this, "NEW FILE CREATED", Toast.LENGTH_SHORT).show();
  
                  } catch (Exception e) {
                      Toast.makeText(getBaseContext(), e.getMessage(),
                              Toast.LENGTH_SHORT).show();
                  }//End of try/catch
  
  
                }//End Write.....
  </code></pre>
  
  <p>And here is the code for reading.... works ok upto 4.1 just not 4.2...</p>
  
  <pre><code>FilePath=getIntent().getStringExtra("FileToOpen");
  
      //Open File and read first all data.......
      try {
          BufferedReader br = new BufferedReader(new FileReader(FilePath));
  
          Tester$ = br.readLine();
          Company$ = br.readLine();
          Customer$ = br.readLine();
          Address1$ = br.readLine();
          Address2$ = br.readLine();
          PCode$ = br.readLine();
          Instr$ = br.readLine();
          InstrSerial$ = br.readLine();
          NumOfTests$ = br.readLine();        
   br.close();
            Toast.makeText(this, "FILE LOADED OK.", Toast.LENGTH_SHORT).show();
  
            n = n+1;    //Increment n for next test number....
  
      }
      catch (IOException e) {
          //You'll need to add proper error handling here
          Toast.makeText(getBaseContext(), e.getMessage(),
                  Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>Any help much appreciated ... Thanks for looking</p>