TC20 Export file to PC

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);


  File file = new File(dirType, fileName);

  FileWriter fileWriter = new FileWriter(file);




  result = true;

  } catch (IOException e){}


   return result;


Many thanks,

Serge !