View RSS Feed

My Java Tips

  1. Reading/writing files

    by , 11-22-2011 at 06:26 PM (My Java Tips)
    This post is all about reading and writing text files on mobile device.

    In order to write files on the mobile device, you need com.motorola.file.writeaccess. If your application has that permission, you can write files easily using the following code.

    Java Code:
    FileConnection sc = (FileConnection)"file:///phone/tmp.txt");
    OutputStream os = sc.openOutputStream();
    os.write(("text to go into the file").getBytes());