Passing Cache Image from one Activity to another ActivityGlide : How to find if the image is already cached and use the cached version?How to control web page caching, across all browsers?How to save an Android Activity state using save instance state?Strange out of memory issue while loading an image to a Bitmap objectLazy load of images in ListViewFling gesture detection on grid layoutStop EditText from gaining focus at Activity startupHow do I pass data between Activities in Android application?Flash CS4 refuses to let goDisabling Chrome cache for website developmentHow to remove a particular image URL from disk cache in Glide?
Is it possible to 'live off the sea'
Why is one of Madera Municipal's runways labelled with only "R" on both sides?
Using a found spellbook as a Sorcerer-Wizard multiclass
An average heaven where everyone has sexless golden bodies and is bored
Why did Canadian English remain so close to standard U.S English?
PhD - Well known professor or well known school?
Watts vs. Volt Amps
Are there downsides to using std::string as a buffer?
Can the poison from Kingsmen be concocted?
Frame failure sudden death?
Dual boot macOS Catalina 10.15 and macOS Mojave 10.14
How do governments keep track of their issued currency?
Trapping Rain Water
Can a user sell my software (MIT license) without modification?
Genetic limitations to learn certain instruments
Implement Homestuck's Catenative Doomsday Dice Cascader
What's up with this leaf?
Why doesn't Adrian Toomes give up Spider-Man's identity?
Preventing Employees from either switching to Competitors or Opening Their Own Business
Payment instructions allegedly from HomeAway look fishy to me
Can an Aarakocra use a shield while flying?
Was there a priest on the Titanic who stayed on the ship giving confession to as many as he could?
How to project 3d image in the planes xy, xz, yz?
Using "subway" as name for London Underground?
Passing Cache Image from one Activity to another Activity
Glide : How to find if the image is already cached and use the cached version?How to control web page caching, across all browsers?How to save an Android Activity state using save instance state?Strange out of memory issue while loading an image to a Bitmap objectLazy load of images in ListViewFling gesture detection on grid layoutStop EditText from gaining focus at Activity startupHow do I pass data between Activities in Android application?Flash CS4 refuses to let goDisabling Chrome cache for website developmentHow to remove a particular image URL from disk cache in Glide?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I load an image from url into an imageview in Activity 1 (using glide). When I switch to activity 2 ,I disconnect my network connection and I'm required to load the same image in another imageview. How am I supposed to achieve this? Can this be done by using the image cached somewhere by glide?
android caching android-glide
add a comment |
I load an image from url into an imageview in Activity 1 (using glide). When I switch to activity 2 ,I disconnect my network connection and I'm required to load the same image in another imageview. How am I supposed to achieve this? Can this be done by using the image cached somewhere by glide?
android caching android-glide
1
this solution would be helpful stackoverflow.com/questions/32406489/…
– Ajay Venugopal
Sep 25 '17 at 6:27
add a comment |
I load an image from url into an imageview in Activity 1 (using glide). When I switch to activity 2 ,I disconnect my network connection and I'm required to load the same image in another imageview. How am I supposed to achieve this? Can this be done by using the image cached somewhere by glide?
android caching android-glide
I load an image from url into an imageview in Activity 1 (using glide). When I switch to activity 2 ,I disconnect my network connection and I'm required to load the same image in another imageview. How am I supposed to achieve this? Can this be done by using the image cached somewhere by glide?
android caching android-glide
android caching android-glide
edited Mar 24 at 16:21
Zoe
15.2k85789
15.2k85789
asked Sep 25 '17 at 6:24
Uday KiranUday Kiran
112
112
1
this solution would be helpful stackoverflow.com/questions/32406489/…
– Ajay Venugopal
Sep 25 '17 at 6:27
add a comment |
1
this solution would be helpful stackoverflow.com/questions/32406489/…
– Ajay Venugopal
Sep 25 '17 at 6:27
1
1
this solution would be helpful stackoverflow.com/questions/32406489/…
– Ajay Venugopal
Sep 25 '17 at 6:27
this solution would be helpful stackoverflow.com/questions/32406489/…
– Ajay Venugopal
Sep 25 '17 at 6:27
add a comment |
3 Answers
3
active
oldest
votes
In your Activity1
Convert ImageView to Bitmap
imageView.buildDrawingCache();
Bitmap bmp = imageView.getDrawingCache();
Intent intent = new Intent(this, Activity2.class);
intent.putExtra("img", bmp);
In Activity2
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("img");
imageView.setImageBitmap(bitmap);
add a comment |
Instead of caching image using glide create your own cache folder and cache images into it.It can be easily accessible throughout the application
Glide.with(yourImageView.getContext())
.load("your url")
.asBitmap()
.placeholder(R.drawable.place_holder)
.error(R.drawable.place_holder)
.into(new SimpleTarget<Bitmap>()
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition)
//Create a folder for caching and add images from here
);
add a comment |
I use this and this works for me:
Add a OnClickListener like below:
Glide.with(this)
.load("URL HERE")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(Image);
Image.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
Intent intent= new Intent(context,FullScreenImage.class);
intent.putExtra("image_url", "URL HERE" );
startActivity(intent);
);
Then in the new Activity:
public class FullScreenImage extends AppCompatActivity
ImageView myImage;
String url = "";
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image);
url = getIntent().getStringExtra("image_url");
myImage = findViewById(R.id.myImage);
Glide.with(this).load(url)
.placeholder(R.drawable.ic_image_send_24dp)
.error(R.drawable.ic_image_send_24dp)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(myImage);
PS: Dont forget to use .diskCacheStrategy(DiskCacheStrategy.ALL)
in both the activities while using glide.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46398802%2fpassing-cache-image-from-one-activity-to-another-activity%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your Activity1
Convert ImageView to Bitmap
imageView.buildDrawingCache();
Bitmap bmp = imageView.getDrawingCache();
Intent intent = new Intent(this, Activity2.class);
intent.putExtra("img", bmp);
In Activity2
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("img");
imageView.setImageBitmap(bitmap);
add a comment |
In your Activity1
Convert ImageView to Bitmap
imageView.buildDrawingCache();
Bitmap bmp = imageView.getDrawingCache();
Intent intent = new Intent(this, Activity2.class);
intent.putExtra("img", bmp);
In Activity2
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("img");
imageView.setImageBitmap(bitmap);
add a comment |
In your Activity1
Convert ImageView to Bitmap
imageView.buildDrawingCache();
Bitmap bmp = imageView.getDrawingCache();
Intent intent = new Intent(this, Activity2.class);
intent.putExtra("img", bmp);
In Activity2
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("img");
imageView.setImageBitmap(bitmap);
In your Activity1
Convert ImageView to Bitmap
imageView.buildDrawingCache();
Bitmap bmp = imageView.getDrawingCache();
Intent intent = new Intent(this, Activity2.class);
intent.putExtra("img", bmp);
In Activity2
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("img");
imageView.setImageBitmap(bitmap);
answered Sep 25 '17 at 6:27
vishal jangidvishal jangid
1,998921
1,998921
add a comment |
add a comment |
Instead of caching image using glide create your own cache folder and cache images into it.It can be easily accessible throughout the application
Glide.with(yourImageView.getContext())
.load("your url")
.asBitmap()
.placeholder(R.drawable.place_holder)
.error(R.drawable.place_holder)
.into(new SimpleTarget<Bitmap>()
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition)
//Create a folder for caching and add images from here
);
add a comment |
Instead of caching image using glide create your own cache folder and cache images into it.It can be easily accessible throughout the application
Glide.with(yourImageView.getContext())
.load("your url")
.asBitmap()
.placeholder(R.drawable.place_holder)
.error(R.drawable.place_holder)
.into(new SimpleTarget<Bitmap>()
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition)
//Create a folder for caching and add images from here
);
add a comment |
Instead of caching image using glide create your own cache folder and cache images into it.It can be easily accessible throughout the application
Glide.with(yourImageView.getContext())
.load("your url")
.asBitmap()
.placeholder(R.drawable.place_holder)
.error(R.drawable.place_holder)
.into(new SimpleTarget<Bitmap>()
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition)
//Create a folder for caching and add images from here
);
Instead of caching image using glide create your own cache folder and cache images into it.It can be easily accessible throughout the application
Glide.with(yourImageView.getContext())
.load("your url")
.asBitmap()
.placeholder(R.drawable.place_holder)
.error(R.drawable.place_holder)
.into(new SimpleTarget<Bitmap>()
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition)
//Create a folder for caching and add images from here
);
answered Sep 25 '17 at 6:32
sharath kumarsharath kumar
3,0311616
3,0311616
add a comment |
add a comment |
I use this and this works for me:
Add a OnClickListener like below:
Glide.with(this)
.load("URL HERE")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(Image);
Image.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
Intent intent= new Intent(context,FullScreenImage.class);
intent.putExtra("image_url", "URL HERE" );
startActivity(intent);
);
Then in the new Activity:
public class FullScreenImage extends AppCompatActivity
ImageView myImage;
String url = "";
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image);
url = getIntent().getStringExtra("image_url");
myImage = findViewById(R.id.myImage);
Glide.with(this).load(url)
.placeholder(R.drawable.ic_image_send_24dp)
.error(R.drawable.ic_image_send_24dp)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(myImage);
PS: Dont forget to use .diskCacheStrategy(DiskCacheStrategy.ALL)
in both the activities while using glide.
add a comment |
I use this and this works for me:
Add a OnClickListener like below:
Glide.with(this)
.load("URL HERE")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(Image);
Image.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
Intent intent= new Intent(context,FullScreenImage.class);
intent.putExtra("image_url", "URL HERE" );
startActivity(intent);
);
Then in the new Activity:
public class FullScreenImage extends AppCompatActivity
ImageView myImage;
String url = "";
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image);
url = getIntent().getStringExtra("image_url");
myImage = findViewById(R.id.myImage);
Glide.with(this).load(url)
.placeholder(R.drawable.ic_image_send_24dp)
.error(R.drawable.ic_image_send_24dp)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(myImage);
PS: Dont forget to use .diskCacheStrategy(DiskCacheStrategy.ALL)
in both the activities while using glide.
add a comment |
I use this and this works for me:
Add a OnClickListener like below:
Glide.with(this)
.load("URL HERE")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(Image);
Image.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
Intent intent= new Intent(context,FullScreenImage.class);
intent.putExtra("image_url", "URL HERE" );
startActivity(intent);
);
Then in the new Activity:
public class FullScreenImage extends AppCompatActivity
ImageView myImage;
String url = "";
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image);
url = getIntent().getStringExtra("image_url");
myImage = findViewById(R.id.myImage);
Glide.with(this).load(url)
.placeholder(R.drawable.ic_image_send_24dp)
.error(R.drawable.ic_image_send_24dp)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(myImage);
PS: Dont forget to use .diskCacheStrategy(DiskCacheStrategy.ALL)
in both the activities while using glide.
I use this and this works for me:
Add a OnClickListener like below:
Glide.with(this)
.load("URL HERE")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(Image);
Image.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
Intent intent= new Intent(context,FullScreenImage.class);
intent.putExtra("image_url", "URL HERE" );
startActivity(intent);
);
Then in the new Activity:
public class FullScreenImage extends AppCompatActivity
ImageView myImage;
String url = "";
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_screen_image);
url = getIntent().getStringExtra("image_url");
myImage = findViewById(R.id.myImage);
Glide.with(this).load(url)
.placeholder(R.drawable.ic_image_send_24dp)
.error(R.drawable.ic_image_send_24dp)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(myImage);
PS: Dont forget to use .diskCacheStrategy(DiskCacheStrategy.ALL)
in both the activities while using glide.
answered Aug 12 '18 at 17:42
Ashish YadavAshish Yadav
1841220
1841220
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46398802%2fpassing-cache-image-from-one-activity-to-another-activity%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
this solution would be helpful stackoverflow.com/questions/32406489/…
– Ajay Venugopal
Sep 25 '17 at 6:27