1

我到这里向我的 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);
4

1 回答 1

1

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

您可以在点击这里找到更多信息

于 2013-03-26T06:43:50.567 回答