0

My problem with the software I'm trying to make is this; when I save the information, it's saved with this code:

Code i save

With this, the information is saved in a text in the SD, but I couldn't to read that information. I've tried with several ways.

I want to save the content of the TXT in a String to put it in a TextView.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mike Brian Olivera
  • 1,414
  • 1
  • 16
  • 21

2 Answers2

0
try 
            {
                String myData ;
                FileInputStream fis = new FileInputStream(your file name);
                DataInputStream in = new DataInputStream(fis);
                BufferedReader br =  new BufferedReader(new InputStreamReader(in));
                String strLine;
                while ((strLine = br.readLine()) != null) {
                 myData = myData + strLine;
            }
                in.close();
               } catch (IOException e) {
                e.printStackTrace();
               }
               // play with myData..It's file content
Looking Forward
  • 3,579
  • 8
  • 45
  • 65
0
        I have tried this code and it works perfectly :D

File ruta_sd = Environment.getExternalStorageDirectory(); File f = new File(ruta_sd.getAbsolutePath(), "datos.txt");

      BufferedReader fin =new BufferedReader(
              new InputStreamReader(
                      new FileInputStream(f)));
      String texto = fin.readLine();
      fin.close();

      textohere.setText(texto);
Mike Brian Olivera
  • 1,414
  • 1
  • 16
  • 21