Joe Friendly
Joe Friendly

Reputation: 11

Android SD card path inaccessible

I have a knock off android device HT-PAD1051

But, really having trouble accessing the root directory in the built in sd card. card is partitioned and what is called "mnt/extsd" is accessible. Any ideas on how to get at root?

The device has been rooted.

Thanks

Joe

Upvotes: 1

Views: 449

Answers (2)

medampudi
medampudi

Reputation: 399

public void writeFile(String text){
        try{
            Writer output = null;
            File dir = new File(Environment.getExternalStorageDirectory() + "/RequiredDirectory");
            dir.mkdirs();

            File file = new File(dir,<filename>);
            output = new BufferedWriter(new FileWriter(file,true));
            output.write(text);
            output.close();
            System.out.println("Your file has been written");  
        }catch (Exception e) {
            e.printStackTrace();
        }
}

Upvotes: 0

user370305
user370305

Reputation: 109237

For any android device, If you want to get external storage always use.

Environment.getExternalStorageDirectory();

instead of giving hard coded path.

Upvotes: 1

Related Questions