我有一个应用程序,我从通知中获取小图标并将其转换为字节[]并将其设置为imageview
结果白色图像。我如何解决这个问题。 代码: -将drawable转换为bytearray并将byte []转换为位图后,它将显示位图为白色?
Context remotePackageContext = null;
Bitmap bmp = null;
try {
PackageManager manager = getPackageManager();
Resources resources = manager.getResourcesForApplication(pack);
Drawable icon = resources.getDrawable(id1);
if(icon !=null) {
bmp = ((BitmapDrawable) icon).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byteArray = stream.toByteArray();
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
,因为我已经把它在SQLite的 – Niraj