1

I'm new to android and I am using Picasso to receive image from my localhost.I want to pass image via intent to another new activity but I'm unable to display the image in my layout.Help me to figure out this problem.

This is my Movie.class

public class Movie {

private String Sno;
private String Name;
private String Director;
private String Image;

public String getSno() {
    return Sno;
}

public void setSno(String sno) {
    Sno = sno;
}

public String getName() {
    return Name;
}

public void setName(String name) {
    Name = name;
}

public String getDirector() {
    return Director;
}

public void setDirector(String director) {
    Director = director;
}

public String getImage() {
    return Image;
}

public void setImage(String image) {
    Image = image;
}

}

MyFragment.class

    public void onClick(View v, int position, boolean isLongClick) {
    String Sno =movieList.get(position).getSno().toString();
    String Name = movieList.get(position).getName().toString();
    String strDirector =         movieList.get(position).getDirector().toString();
    String strImage = movieList.get(position).getImage().toString();

    Intent intent = new Intent(getActivity(),Movie_detail.class);
    intent.putExtra("Sno",Sno);
    intent.putExtra("Director",strDirector);
    intent.putExtra("Name",Name);
    intent.putExtra("Image",strImage);

    startActivity(intent);
    }

Movie_detail.class

    Intent intent= getIntent();
    ImageView imageView = (ImageView) findViewById(R.id.imageView);
    strImage= String.valueOf(intent.getStringExtra("strImage"));

    Picasso.with(this)
            .load(strImage)
            .into(imageView);

2 Answers2

0

Try to use this code and see what do you have in strImage and paste here in comment

Updated:

 Intent intent= getIntent();
        ImageView imageView = (ImageView) findViewById(R.id.imageView);
        strImage= String.valueOf(intent.getStringExtra("Image"));
        Log.d("LOG_TAG" strImage);
        Picasso.with(this)
                .load(strImage)
                .into(imageView);
Sergey Zabelnikov
  • 1,855
  • 1
  • 14
  • 24
0

Intent intent= getIntent();

    ImageView imageView = (ImageView) findViewById(R.id.imageView);

    strImage= String.valueOf(intent.getStringExtra("Image"));

    Log.d("LOG_TAG" strImage);
    Picasso.with(this)
            .load(strImage)
            .into(imageView);

try to focus on elements which is inside double quotes.