Ahmed Salem
Ahmed Salem

Reputation: 1757

Can't read/write to sdcard in Android

Can any one help in that problem

when i try that code

File routesRoot = Environment.getExternalStorageDirectory();
            if (!routesRoot.canWrite())
                System.out.println("can't write root");
            if (!routesRoot.canRead())
                System.out.println("can't read root");

when run program both can't write /read occure

I have set permission to access sdcard what is the problem ??

Upvotes: 4

Views: 8296

Answers (2)

himura
himura

Reputation: 1605

If you are using your phone, make sure that your SD card is not mounted on your computer Check also if you are using android SDK over 1.5

Upvotes: 0

Teja Kantamneni
Teja Kantamneni

Reputation: 17482

Do you have this in your manifest.xml??

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

From android SDK ver 4, you have to specify this in your manifest file to give the permissions.

Upvotes: 7

Related Questions