【发布时间】:2016-04-04 10:28:19
【问题描述】:
大家好,我有一个问题,我想在我的项目中包含一个图像,当用户单击打印按钮时,图像将被打印,然后是其他信息,但我没有将图像路径传递给 PrintTool
PrintTool.printPhotoWithPath(imagePath, this);
printtool 的第一行就是这个
public static void printPhotoWithPath(String filePath, Context context) {
// Get the picture based on the path
File mfile = new File(filePath/*path*/);
if (mfile.exists()) {
Bitmap bmp = BitmapFactory.decodeFile(filePath/*path*/);
byte[] command = decodeBitmap(bmp);
printPhoto(command, context);
}else{
Log.e("PrintTools_58mm", "the file isn't exists");
}
}
所以我的问题是,我怎样才能从可绘制文件夹中的图像到代码的路径?
【问题讨论】:
标签: android string path android-drawable