ins*_*iac 1 android file filepath android-emulator
我是android的新手,不太了解它.我已将图像导入到我的项目中,当我尝试使用文件检查文件是否存在时.
这是我用过的代码..
existingFileName="res/drawable-ldpi/login.png";
File f= new File(existingFileName);
// Log.d("Image path",);
if(f.exists())
{
Log.d("EXISTS", "====File Exists===");
}
Run Code Online (Sandbox Code Playgroud)
它仍然显示我没有图像存在.
aby,谢谢你的帮助
如果您将图像放在可绘制的文件夹中,我认为您不能像这样访问它们.试试这个
Drawable image= getResources().getDrawable(R.drawable.<id>);
Run Code Online (Sandbox Code Playgroud)
id将是您的文件名.
| 归档时间: |
|
| 查看次数: |
4172 次 |
| 最近记录: |