下面是我处理徽标打印的代码。徽标放置在 res/drawable 文件夹中。当我运行该应用程序时,它会抛出:
java.io.FileNotFoundException: /android.resource:/com.android.test/2130837505 (No such file or directory).
有什么建议吗?
public boolean printLogo()
{
Uri logo_path = Uri.parse("android.resource://com.android.test/" + R.drawable._logo);
File logo = new File(logo_path.toString());
byte[] logo_bytes = new byte[(int) logo.length()];
System.out.print("Length:" + logo.length());
FileInputStream fs;
try {
fs = new FileInputStream(logo);
fs.read(logo_bytes);
fs.close();
mChatService.write(logo_bytes);
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
return true;
}