Shubhendra Shubhendra - 1 year ago 60
Android Question

How to pass the user image(fetched from Facebook profile) from navbar to another activity

This is my Activity 1

final Intent ridesameIntent = new Intent(this, Activity2.class);
TextView userText = (TextView) findViewById(;
ImageView userImage = (ImageView) findViewById(;
String userNameMessage = userText.getText().toString();
String userPicMessage = userImage.toString();

This is Activity 2

Intent userDetail = getIntent();
String userPicMessage = userDetail.getStringExtra(Activity1.EXTRA_MESSAGE_USERPIC);
String userNameMessage = userDetail.getStringExtra(Activity1.EXTRA_MESSAGE_USERNAME);
TextView userdetail1 = (TextView) findViewById(;
ImageView userdetail2 = (ImageView) findViewById(;

I have tried passing the uri but getting no results in passing the user pic
also for help here is the code which fetches user profile from Facebook and sets it into the navbar of Activity 1

public void setUserProfile(String jsondata) {

try {
response = new JSONObject(jsondata);
profile_pic_data = new JSONObject(response.get("picture").toString());
profile_pic_url = new JSONObject(profile_pic_data.getString("data"));


} catch (Exception e) {

So please suggest me how can i get the image to activity 2.

Answer Source

You can pass the image Bitmap through the intent to the second activity as it implements the Parcelable interface.

Bitmap profileBitmap = ((BitmapDrawable)user_picture.getDrawable()).getBitmap();
ridesameIntent.putExtra("profilePic", profileBitmap);

And on the other end :

Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("profilePic");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download