为什么ImageView不会在我的应用中出现图像?

问题描述 投票:0回答:2

我在服务器中保存了照片,并在我的应用程序的另一个地方显示它,但图像没有出现在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/[email protected]";
    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;
}
java android picasso
2个回答
1
投票

在OP评论之后,我们最终得出结论,问题实际上是在String url变量中,该变量不包含有效的URL字符串(缺少http://)。

所以解决方案就是这样做的:

//String url = "http://sae-marketing.com/gamaia/PHOTOS/[email protected]";
String url = "http://" + Images.get(position); 

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

0
投票

你可以使用开启毕加索的日志

Picasso.with(Context).setLoggingEnabled(true)

您可能会看到一条错误消息,其中包含原因

© www.soinside.com 2019 - 2024. All rights reserved.