在 ImageView 中加载的图像在片段重新加载时消失

Hem*_*mal 5 android-imageview android-fragments

我有一个片段来编辑内容。在这个片段中,我有 ImageView,它显示从画廊或相机中选取的图像 这个片段反过来也打开了另一个片段。当我回到编辑片段时,从这个片段中显示的图像消失,ImageViews 变为空白,其他所有内容(Edittext、Textviews)保持不变(填充)

请注意,当我返回编辑片段时,它的 OnCreateView 被调用而不是 OnCreate 方法,例如,当我们用另一个片段替换片段并弹出回到前一个片段时,首先调用它的 OnCreateView 方法

我不明白发生了什么请帮助。

IRv*_*ziE 2

老了,但这也许可以帮助其他人。

我通过将源路径设置为变量来解决这个问题,然后调用 onResume() 方法。

@Override
public void onResume() {
    super.onResume();

    //set again your ImageView source here..
}
Run Code Online (Sandbox Code Playgroud)