Hi,
I am new to Android development. I was wondering how the file
operations works in Android. As in J2ME it has FileConnection class
that takes care of most of the File operation tasks.. and it
FileConnection doesn't support Android, what is the best way to
accomplish the File Operation tasks? I would appreciate if someone
could send me some code snippet: Thanks..

Tasks I want to do :

1) Create a Directory( check for its existence first, if not then
create it)
2) Create a File in the newly created Directory
3) Write data into the file
4) Read from the file
5) Delete the file

I want to create the file in Built-in memory or SDCard.. so for this,
how do I specify the PATH.?

 public static boolean createDir(final String path){
                   System.out.println("Creating the Dir.. : " +  path );

                   File file = null;
                   boolean bSuccess = false;

                   try{
                 file = new File(path);

                 if(file.mkdir()){
                        bSuccess = true;
                }

                   }catch(Exception e){
                    e.printStackTrace();
                    System.out.println("FILE ERROR : " + e.toString());
                }

                   return bSuccess;
           }


I have already set up android.permission.WRITE_EXTERNAL_STORAGE
permission..

Thanks for your help in advance..

Regards,
DK

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to