You can use the following code snippet to access sdcard -
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable =
true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other
states, but
all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable =
false;
}
if(mExternalStorageAvailable)
{
File file[] =
Environment.getExternalStorageDirectory().listFiles();
}
Let me know if it helps !!
Thanks
On Oct 22, 8:32 am, Miguel Morales <[email protected]> wrote:
> Google offers some good documentation on
> this:http://developer.android.com/guide/topics/data/data-storage.html
>
>
>
>
>
> On Thu, Oct 21, 2010 at 8:30 PM, MG <[email protected]> wrote:
> > Hello everyone!
>
> > I juts want to know how can I access a certain data from my SD card.
> > How can I browse SD card contents?
> > For example, from my application, I want to open a pdf file from SD
> > card,
> > how am I going to do this?
>
> > I tried to write this code but it doesnt seem to work.
>
> > Uri uri = Uri.parse("file:///sdcard/");
> > Intent intent = new Intent(Intent.ACTION_PICK, uri);
> > startActivity(intent);
>
> > Thank you.
>
> > --
> > 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
>
> --
> ~ Jeremiah:9:23-24
> Android 2D
> MMORPG:http://developingthedream.blogspot.com/,http://www.youtube.com/user/revoltingx
--
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