File read write operations on Android2.2

Discussion in 'Android Tablet Discussions' started by ajaypal, Sep 14, 2011.

  1. ajaypal

    ajaypal Member

    Joined:
    Sep 14, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    60
    Location:
    delhi
    Tablet / Device:
    wespro 786
    We are using Android2.2. We are developing application which will read from a Textview and then write data entered into a file. We are using below code to perform file I/O operation. We are not getting any comilation error nor any exception but file is not getting opened and data is not being written in file. Please suggest what is the problem or what other code we should use.


    <code>

    username = userid.getText().toString();
    password = pwd.getText().toString();
    FileOutputStream fos = openFileOutput("out.txt", Context.MODE_PRIVATE);
    fos.write(username.getBytes());
    fos.close();

    </code>
     

Share This Page