Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我来到这里是为了给我的android应用程序添加一个图像,但是有一条错误线_Android_Image_Android Resources - Fatal编程技术网

我来到这里是为了给我的android应用程序添加一个图像,但是有一条错误线

我来到这里是为了给我的android应用程序添加一个图像,但是有一条错误线,android,image,android-resources,Android,Image,Android Resources,我来到这里是为了在我的android应用程序中添加一个图像,但有一条错误行: String pathName = "chemistry\2013_03_26\chemistry1.pdf";//Error line Resources res = getResources(); Bitmap bitmap = BitmapFactory.decodeFile(pathName); BitmapDrawable bd = new BitmapDrawable(res, bitmap); View

我来到这里是为了在我的android应用程序中添加一个图像,但有一条错误行:

String pathName = "chemistry\2013_03_26\chemistry1.pdf";//Error line
Resources res = getResources();
Bitmap bitmap = BitmapFactory.decodeFile(pathName);
BitmapDrawable bd = new BitmapDrawable(res, bitmap);
View view = findViewById(R.id.container);
view.setBackgroundDrawable(bd);

我认为您应该将绝对路径与
getfiledir()
getExternalFileDir()
一起使用


您可以在

上找到更多信息。我认为您应该将绝对路径与
getfiledir()
getExternalFileDir()
一起使用


有关更多信息,请访问

“chemistry\2013\u 03\u 26\chemistry1.pdf”不是有效的路径。如果映像位于使用映像的SD卡上,请使用
Environment.getExternalStorageDirectory()
获取SD卡路径?SD卡??服务器??阿瑟??可绘制???
“chemistry\2013\u 03\u 26\chemistry1.pdf”不是有效的路径。如果映像位于使用映像的SD卡上,请使用
Environment.getExternalStorageDirectory()
获取SD卡路径?SD卡??服务器??阿瑟??可拉伸??