How to pass the URL/URI from Activity A on Item Click to Activity B Where the Image is to Be Loaded from the URL?
on Activity A
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
HttpGet imageurl = new HttpGet("https://jiresal-test.s3.amazonaws.com/deal3.png");
Intent freebie = new Intent(this,PuzzleActivity.class);
freebie.putExtra("image", imageurl.toString());
startActivity(freebie);
Toast.makeText(this, "Item Clicked: " + position, Toast.LENGTH_SHORT).show();
}
on Activity B
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent)
{
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch(requestCode)
{
case RESULT_SELECT_IMAGE:
{
if(resultCode == RESULT_OK)
{
Uri selectedImage = imageReturnedIntent.getData();
loadBitmap(selectedImage);//Where to Load Image
}
break;
}
Activity B has to Load Image not show URL?URI
Activity B Loads Image form class - loadBitmap(selectedImage);//Where to Load Image
I think you misunderstood things about startActivityForResult() and onActivityResult().You can check out android SDK documents to see how they work.
In your case ,you can get the url in the onCreate() of B like this: