Hi, I'm trying to write a file to a sdcard, I'm using the same writeToFile() function in all my apps, and I dont know why, it wont work for this one, no idea why. It works for all the other apps, but not for this one.
I have two classes, GPSTest, and GPSListener. writeToFile() is in GPSListener, and called from this one too. Here is the code: public void writeToFile(String text) { // SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); // resultsFile = prefs.getString("fileName", "default"); BufferedOutputStream buf = null; File file = new File("/sdcard/GPS Test/results/results.txt"); try { buf = new BufferedOutputStream( new FileOutputStream(file,true)); buf.write(text.getBytes()); System.out.println(text.getBytes()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (buf != null) { buf.flush(); buf.close(); } } catch (IOException ex) { ex.printStackTrace(); } } } Thanks for your help, I really cant figure it out. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en