Android的:如何访问一个文件的SD卡文件、Android、SD

2023-09-04 13:22:40 作者:别堕落!你没资格

我想用下面code访问图像的SD卡上,但我的M获取文件未发现异常。谁能告诉我接取文件???一个正确的方法

 新建文件(到/ mnt / SD卡/ splah2.jpg)
 

解决方案

尝试这样的:

 字符串SD_CARD_PATH = Environment.getExternalStorageDirectory()的toString();
新的文件(SD_CARD_PATH +/+splah2.jpg);
 

Android存储文件到SD卡中

I'm trying to access the image on the SD card using below code but I"m getting File not found exception. Can someone tell me a correct way to acess the file???

new File("/mnt/sdcard/splah2.jpg")

解决方案

Try like this:

String SD_CARD_PATH = Environment.getExternalStorageDirectory().toString();
new File(SD_CARD_PATH + "/" + "splah2.jpg");