I have saved my gif on Sharedpreference like this
protected void onActivityResult(int requestcode, int resultcode,
Intent imagereturnintent) {
super.onActivityResult(requestcode, resultcode, imagereturnintent);
switch (requestcode) {
case select_photo:
if (resultcode == RESULT_OK) {
Uri imageuri = imagereturnintent.getData();
uriPath.setText("URI Path: " + imageuri.toString());
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Name, imageuri.toString());
editor.apply();
Glide.with(getApplicationContext()).load(Uri.parse(imageuri.toString())).into(gallery_image);
}
}
and then I reload Glide in oncreate like this
sharedpreferences = getSharedPreferences(mypreference,
Context.MODE_PRIVATE);
if (sharedpreferences.contains(Name)) {
String Agi= sharedpreferences.getString(Name, "");
Glide.with(getApplicationContext()).load(Uri.parse(Agi)).into(gallery_image);
}
Glide works fine when I exit and return to the app, but as soon as I kill the app(because users may do that to boost their phone),the gif will not show anymore. The strange thing is that with a normal image.jpg works fine even after app kill.