Reputation: 590
am sending an image with help of intent as follow
Uri profileImage = Uri.parse("android.resource://Tset/res/drawable-hdpi/arr.jpeg");
details.setType("image/png");
details.putExtra(Intent.EXTRA_STREAM, profileImage);
startActivity(details);
how do i can get the image path in my receiving end activity ?
Upvotes: 1
Views: 1410
Reputation:
Try This Pass image url from current activity using intent
Intent myIntent = new Intent(this, MyImageViewActivity.class);
Bundle bundle = new Bundle();
bundle.putString("image", path);
myIntent.putExtras(bundle);
startActivityForResult(myIntent, 0);
Here path is
String path="android.resource://Tset/res/drawable-hdpi/arr.jpeg"
in your receiving activity
Bundle bundle = this.getIntent().getExtras();
String path = bundle.getString("image");
Upvotes: 3
Reputation: 590
Finally i done it with help of id of the image as follow ! ! thanks for all of ur reply ! !
profilePictureID=R.drawable.image name;//name of image in drawable folder dont use extensions like.jpg and all
IntentObject.putExtra("ImageID",profilePictureID);
startActivity(IntenetObject);
In receiving activity
int pictureId=getIntent().getIntExtra("ImageID",0);
profilePicture.setImageResource(pictureId);
Upvotes: 2
Reputation: 4217
Try this..
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(path)), "image/png");
startActivity(intent);
Upvotes: 1