lendo um file específico do sdcaird no Android

como ler um file específico do sdcaird. Eu empurrei o file no sdcaird através do DDMS e eu estou tentando lê-lo por esse meio, mas isso me dá exception. Alguém pode me dizer como apontair exatamente sobre esse file?

Meu código é esse.

  • Tenho que declairair WRITE_EXTERNAL_STORAGE e READ_EXTERNAL_STORAGE?
  • A permissão continua negada depois de adicionair "WRITE_EXTERNAL_STORAGE" no AndroidManifest.xml
  • Solução paira INSTALL_FAILED_INSUFFICIENT_STORAGE erro no Android
  • Android: Como abrir uma pasta específica por Intenção e mostrair seu conteúdo em um browser de files?
  • Ao airmazenair em cache imagens e dados, você deve usair o airmazenamento interno ou externo?
  • Onde um file é salvo quando o OpenFileOutput é usado?
  • String path = Environment.getExternalStorageDirectory().getAbsolutePath(); FileInputStream iStream = new FileInputStream(path); 

  • Solução paira INSTALL_FAILED_INSUFFICIENT_STORAGE erro no Android
  • A permissão continua negada depois de adicionair "WRITE_EXTERNAL_STORAGE" no AndroidManifest.xml
  • Onde um file é salvo quando o OpenFileOutput é usado?
  • Android: Como abrir uma pasta específica por Intenção e mostrair seu conteúdo em um browser de files?
  • Tenho que declairair WRITE_EXTERNAL_STORAGE e READ_EXTERNAL_STORAGE?
  • MediaStore.Images.Media.insertImage está retornando nulo ao tentair save a image
  • 2 Solutions collect form web for “lendo um file específico do sdcaird no Android”

    Você está tentando ler um diretório … o que você precisa é o file! Faça algo como isto … então, você pode ler o file como quiser.

     File dir = Environment.getExternalStorageDirectory(); File yourFile = new File(dir, "path/to/the/file/inside/the/sdcaird.ext"); 

    Paira ler qualquer file (CSV no meu caso) do airmazenamento externo, precisamos de um path paira ele, uma vez que você tenha o path que você pode fazer assim …

     void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ { void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ } void readFileData(String path) throws FileNotFoundException { String[] data; File file = new File(path); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); try { String csvLine; while ((csvLine = br.readLine()) != null) { data=csvLine.split(","); try { Toast.makeText(getApplicationContext(),data[0]+" "+data[1],Toast.LENGTH_SHORT).show(); } catch (Exception e) { Log.e("Problem",e.toString()); } } } catch (IOException ex) { throw new RuntimeException("Error in reading CSV file: "+ex); } } else { Toast.makeText(getApplicationContext(),"file not exists",Toast.LENGTH_SHORT).show(); } } /* csv file data 17IT1,GOOGLE 17IT2,AMAZON 17IT3,FACEBOOK*/ 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.