毕加索没有从Parse.com上载图像

时间:2016-03-22 17:19:30

标签: android parse-platform

FragmentParseQuery Images获取parse database

  ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(ParseConstants.CLASS_AROUNDME);
               query.orderByDescending(ParseConstants.KEY_CREATED_AT);
               query.whereEqualTo(ParseConstants.KEY_RECIPIENT_IDS, ParseUser.getCurrentUser().getUsername());
               ob = query.find();

               for (ParseObject feeds : ob) {
                   ParseFile thumb = (ParseFile) feeds.get(ParseConstants.KEY_THUMB);
                   //ParseFile video = (ParseFile) feeds.get("file");
                   ParseFeeds map = new ParseFeeds();
                   //map.setImage(thumb.getUrl());
                  //Uri videoUri = Uri.parse(video.getUrl());
                   map.setThumb(thumb.getUrl());
                   feedsarraylist.add(map);

我将此thumb.getUrl()传递给我的Adapter,并使用Picasso加载

 public FeedsGridAdapter(Context context, List<ParseFeeds> feedsarraylist) {
        this.context = context;
        this.feedsarraylist = feedsarraylist;
        inflater = LayoutInflater.from(context);
        this.arraylist = new ArrayList<ParseFeeds>();
        this.arraylist.addAll(feedsarraylist);
        Picasso.with(context);
    }

public View getView(final int position, View view, ViewGroup parent) {
        final ViewHolder holder;
        if (view == null) {
            holder = new ViewHolder();
            view = inflater.inflate(R.layout.feeds_image, null);
            // Locate the ImageView in gridview_item.xml
            holder.ThumbView = (ImageView) view.findViewById(R.id.videoThumb);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        } view.setVisibility(View.GONE);
        // Load image into GridView
        Picasso.with(context).load(feedsarraylist.get(position).getThumb()).into(holder.ThumbView);

images Picasso未加载ImageView if(request != null && request.contains("<xml")){ XMLInputFactory xif = XMLInputFactory.newFactory(); StringReader reader = new StringReader(request); StreamSource xml = new StreamSource(reader); XMLStreamReader xsr = xif.createXMLStreamReader(xml); xsr.nextTag(); request = xsr.getElementText(); System.out.println("updated request is \n"+request); }

2 个答案:

答案 0 :(得分:1)

当您从image获取Parse Cloud时,Thread上的时间解析工作已加载image,但加载到catch memory,请始终使用Picasso Lib所以将其placeholder设置为默认image,如..

Picasso.with(mFragment.getActivity()).load(mCardList.get(i).getProfilePictureFiles().get(0).getUrl()).into(image).placeholder(R.drawable.ic_launcher);

另一方面,您已在arraylist中添加getter setter时间来取parsefile个对象。

答案 1 :(得分:0)

首先检查您的图像是否已从feedsarraylist.get(position).getThumb()正确加载:

Picasso.with(context)
    .load(feedsarraylist.get(position).getThumb())
    .error(R.drawable.error_placeholder_image)
    .into(holder.ThumbView, new com.squareup.picasso.Callback() {
                        @Override
                        public void onSuccess() {
                            Log.d(TAG,"onSuccess");
                        }

                        @Override
                        public void onError() {
                            Log.d(TAG,"Error ocurred");
                        }
                    });

希望这会有所帮助!!