First, you use Environment.getExternalStorageDirectory() to get at the
root of external storage, rather than hard-wiring in /sdcard (which is
the wrong value, anyway).

Second, you delete the READ_EXTERNAL_STORAGE permission request, since
there is no such permission.

Third, you execute the correct code, as your error message refers to
test.txt, whereas your code refers to test30fps.mp4.

On Mon, Apr 30, 2012 at 5:46 AM, Rohit <[email protected]> wrote:
> While reading file from sd card it throws "/sdcard/test.txt
> (Permission Denied)"  exception
> I am using following code to read file and I also set following
> permission in manifest.xml
>
> <user-permission
> android:name="android.permission.READ_EXTERNAL_STORAGE" />
>
>
>
>                               File myFile1 = new File("/sdcard/
> test30fps.mp4");
>                                myFile1.canRead();
>                                FileInputStream fIn = new 
> FileInputStream(myFile1);
>                                BufferedReader myReader = new BufferedReader(
>                                                new InputStreamReader(fIn));
>                                String aDataRow = "";
>                                String aBuffer = "";
>                                while ((aDataRow = myReader.readLine()) != 
> null) {
>                                        aBuffer += aDataRow + "\n";
>                                }
>
>                                myReader.close();
>
> what should i do to read file from SD card?
>
> --
> 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



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
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