2 Replies Latest reply on Feb 4, 2019 5:04 AM by Serge Moers

    TC20 Export file to PC

    Serge Moers

      Dear all,

      I have developed a small application in order to format the scanned data.  At the end of process, the data are stored in the text file.

      I would like save this text file into a folder for that this can be loaded from PC when the TC20 is connected by USB at the PC.

      If I use the code proposed by Android, it's not working.

       

      Can you indicate to me, how to do to store my text file in the external storage ?

       

      public boolean write(String dirType, String fileName, String data){

         boolean result = false;

         if (isOpen){

        String path = Environment.getExternalStoragePublicDirectory(dirType).getAbsolutePath();

        Log.d(Startup.LOG_TAG,"External storage write path : " + path);

         try{

        File file = new File(dirType, fileName);

        FileWriter fileWriter = new FileWriter(file);

        fileWriter.write(data);

        fileWriter.flush();

        fileWriter.close();

        result = true;

        } catch (IOException e){}

        }

       

         return result;

      }

       

      Many thanks,

      Serge !