Does PrintWriter not work on Android?

1

I'm trying to run this code, but it does not work, the error in try {}, in Java it works perfectly.

public void criatxt(){

      String texto = "XXX";

      try{
         PrintWriter arq = new PrintWriter("meudocumento.txt");
         System.out.println("Salvou");
         arq.print(texto);
         arq.close();
      }
      catch(Exception er){
         er.printStackTrace();  
         System.out.println("Salvou: "+ er.getStackTrace());
      }
}

The error in Exception is this: Ljava.lang.StackTraceElemente; @xxxxxxx

    
asked by anonymous 25.08.2015 / 15:02

0 answers