Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – 如何在ImageViews中加载多个图像(parse.com)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

我在parse.com上将5张图片保存到了我的班级.我可以在imageView中基于objectid下载一个图像.我需要将所有5张图像下载到我的5张ImageViews中.我怎样才能做到这一点.任何帮助,将不胜感激.谢谢

ParseQuery<>SEObject> query = new ParseQuery<>SEObject>("Footer");
            // Locate the objectId from the class
    query.geTinBACkground("tNp607WyQD",new GetCallBACk<>SEObject>() {
                public void done(ParSEObject object,ParseException E) {
                    // TODO Auto-generated method stub
                    // Locate the column named "Imagename" and set
                    // the String
                    ParseFile fiLeobject = (ParseFilE) object.get("imageFile");
                    fiLeobject.getDataInBACkground(new GetDataCallBACk() {
                                public void done(byte[] data,ParseException E) {
                                    if (e == null) {
                                        Log.d("test","We've got data in data.");
                                        // Decode the Byte[] into
                                        // Bitmap
                                        Bitmap bmp = BitmapFactory.decodeByteArray(data,data.length);
                                        // Get the ImageView from main.xml
                                        //ImageView image = (ImageView) findViewById(R.id.ad1);
                                        ImageView ad1=(ImageView) findViewById(R.id.ad1);
                                        // Set the Bitmap into the
                                        // ImageView
                                        ad1.setImageBitmap(bmp);
                                        // Close progress dialog
                                        progressDialog.dismiss();
                                    } else {
                                        Log.d("test","There was a problem downloading the data.");
                                    }
                                }
                            });
                }
            });
}}
最佳答案
我可以在imageloader类的帮助下解决这个问题:

public class Login extends Activity {
public ImageLoader imgl;
EditText fullname,mobilenumber,Occupation;
 Button save;
 ImageView ad1,ad2,ad3,ad4,ad5,ad6;  
 List<>SEObject> ob;

 private ImageView[] imgs = new ImageView[5];
 ProgressDialog progressDialog;
 int i=0;
 horizontalscrollview horizontalscrollview1;        

public void onCreate(Bundle savedInstanceStatE) {
     super.onCreate(savedInstanceStatE);
     setContentView(R.layout.userdata);
     imgl=new ImageLoader(getApplicationContext());
     fullname = (EditText) findViewById(R.id.fullName) ;
     mobilenumber = (EditText) findViewById(R.id.mobilE) ;
    Occupation = (EditText) findViewById(R.id.Occupation) ;
     save=(Button) findViewById(R.id.btnSavE);      
    horizontalscrollview1=(horizontalscrollview) findViewById(R.id.horizontalscrollview1);
    ad1=(ImageView) findViewById(R.id.ad1);
    ad2=(ImageView) findViewById(R.id.ad2);
    ad3=(ImageView) findViewById(R.id.ad3);
    ad4=(ImageView) findViewById(R.id.ad4);
    ad5=(ImageView) findViewById(R.id.ad5);
    ad6=(ImageView) findViewById(R.id.ad6);
     imgs[0] = ad2; 
     imgs[1] = ad3; 
     imgs[2] = ad4; 
     imgs[3] = ad5; 
     imgs[4] = ad6;

     progressDialog= ProgressDialog.show(Login.this,"","Downloading Image...",truE);
                // Locate the class table named "Footer" in Parse.com
     ParseQuery<>SEObject> query = new ParseQuery<>SEObject>(
             "Footer");
     query.orderByDescending("updatedAt");
     try {
        ob = query.find();
    } catch (ParseException E) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
     for (ParSEObject country : ob) {
         ParseFile image = (ParseFilE) country.get("imageFile");
         imgl.DisplayImage(image.getUrl(),imgs[i]);
        i=i+1;
         System.out.println("the urls are"+image.getUrl());
     progressDialog.dismiss();
     }
 }
}

大佬总结

以上是大佬教程为你收集整理的android – 如何在ImageViews中加载多个图像(parse.com)全部内容,希望文章能够帮你解决android – 如何在ImageViews中加载多个图像(parse.com)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。