简体   繁体   English

为什么ImageView在我的应用程序中不显示图像?

[英]Why ImageView Not appear image in my app?

i saved photo in server and show it in another place in my app but image doesn't appear in imageview and when i make log.e for url of image url was correct so i don't know why image not appear in imageview any help ???? 我将照片保存在服务器中并在应用程序的其他位置显示,但是图像未出现在imageview中,并且当我进行log.e时,图像url的URL是正确的,所以我不知道为什么图像未出现在imageview中没有任何帮助????

public CustListMis(Activity context, ArrayList<String> NameArray, ArrayList<String> quantityArray, ArrayList<String> durationArray, ArrayList<String> dTimeArray, ArrayList<String> Images) {
    super(context, R.layout.temp_mis, quantityArray);
    this.context = context;
    this.NameArray = NameArray;
    this.quantityArray = quantityArray;
    this.durationArray = durationArray;
    this.dTimeArray=  dTimeArray;
    this.Images = Images;

}


@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = context.getLayoutInflater();
    View listViewItem = inflater.inflate(R.layout.temp_mis, null, true);
    TextView name = (TextView) listViewItem.findViewById(R.id.name);
    TextView quantity = (TextView) listViewItem.findViewById(R.id.quantity);
    TextView duration = (TextView) listViewItem.findViewById(R.id.duration);
    TextView dTime = (TextView) listViewItem.findViewById(R.id.dTime);
    ImageView myUploadImage = (ImageView)listViewItem.findViewById(R.id.imageyy);

    String url = Images.get(position);
   // String url = "http://sae-marketing.com/gamaia/PHOTOS/dream.age25@gmail.com-554806.png";
    Log.e("image",url);
    Picasso.with(context).load(url).noFade().resize(50, 50).centerCrop().into(myUploadImage);


    name.setText(NameArray.get(position));
    quantity.setText(quantityArray.get(position));
    duration.setText(durationArray.get(position));
    dTime.setText(dTimeArray.get(position));


    return listViewItem;
}

Following OP comments we eventually ended up that the problem was really in the String url variable that does not contains a valid URL string (missing http:// ). 在OP注释之后,我们最终发现问题出在真正的String url变量中,该变量不包含有效的URL字符串(缺少http:// )。

So the solution ended in doing that: 因此,解决方案结束了:

//String url = "http://sae-marketing.com/gamaia/PHOTOS/dream.age25@gmail.com-554806.png";
String url = "http://" + Images.get(position); 

ImageView iv = findViewById(R.id.imageView);
Picasso.with(this).load(url).into(iv);

ou can turn on Picasso logs using 您可以使用以下方式打开毕加索日志

Picasso.with(Context).setLoggingEnabled(true)

You will probably see an error message with a reason there 您可能会看到一条错误消息,其中有一个原因

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM