简体   繁体   English

通过parse.com添加图片库

[英]Adding Image Gallery with parse.com

I want to add images to a gridView. 我想将图像添加到gridView。 I am pulling my content from Parse.com. 我正在从Parse.com提取内容。 I won't have them in the resource folders, so I can't find a tutorial that is useful. 我不会在资源文件夹中找到它们,因此找不到有用的教程。 This is the code I have thus far; 这是我到目前为止的代码;

 progressDialog = ProgressDialog.show(manager.this, "", "Loading images...", true);


    ParseQuery<ParseObject> query = ParseQuery.getQuery("fightGallery");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> parseObjects, com.parse.ParseException e) {
            if (e == null) {
                int i = 0;
                final int size = parseObjects.size();

                while (i < size) {
                    ParseFile fileObject = parseObjects.get(i).getParseFile("image");
                    fileObject.getDataInBackground(new GetDataCallback() {
                        @Override
                        public void done(byte[] bytes, ParseException e) {
                            if (e == null) {
                                Log.d("Data", "We have data successfully");
                                Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
                                ImageView img = (ImageView) findViewById(R.id.imageView);
                                img.setImageBitmap(bmp);
                                Log.d("IMAGES", "IMAGES LOADED SUCCESSFULLY");
                                progressDialog.dismiss();
                            } else {
                                Log.d("ERROR: ", "" + e.getMessage());
                                progressDialog.dismiss();
                            }
                        }
                    });
                    i++;

                }
            } else {
                Log.d("ERROR:", "" + e.getMessage());
                progressDialog.dismiss();
            }
        }
    });

How should I add this to a gallery of any sort. 我该如何将其添加到任何种类的画廊中。 I'm not picky. 我不挑剔

I believe this link is going to solve all your problems related to saving images and also to showing them in the gridview. 我相信此链接将解决您与保存图像有关的所有问题,并在gridview中显示它们。

https://github.com/nostra13/Android-Universal-Image-Loader https://github.com/nostra13/Android-Universal-Image-Loader

I dont know if i am late or so but in this link you can find exactly what you need! 我不知道我是否迟到,但是在此链接中您可以找到所需的确切信息! Enjoy! 请享用!

Android Begin GridView Tutorial with Parse.com Data Android使用Parse.com数据开始GridView教程

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

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