无法从 ImageButton 获取图像,因为 returns null

Cannot get an Image from ImageButton because returns null

我有一个 activity,其中填充了来自 sqlite 的数据。

我想更新数据并单击我的更新按钮,我看到了我的所有数据,包括从我的 sqlite 数据库加载的 ImageButton 中的图像。

我尝试使用

获取已保存并显示的图像
ImageButton Logo;
Drawabable drawableLogo = Logo.getDrawable();

但我得到空值!如果 Logo imagebutton 有一个图像,我如何得到 null?

我在这里忘记了什么?

谢谢

使用 BitmapDrawable 从 ImageView/ImageButton 获取位图。

Bitmap drawableLogo = ((BitmapDrawable) Logo.getDrawable()).getBitmap();
ImageButton Logo; // Logo??
Drawabable drawableLogo = Logo.getDrawable();

ImageButton logo;  
logo = (ImageButton ) findViewById(R.id.mylogo):
Drawabable drawableLogo = logo.getDrawable();

所以

Drawabable drawableLogo = new Drawable():
drawableLogo = logo.getDrawable();