我可以将ProgressCallback用于loadInBackground吗? parse.com

时间:2015-12-22 15:09:50

标签: android parse-platform android-progressbar

我的ListView中有一个继承自parse.com数据库的ParseImageView。但android studio表示它无法解析ProgressCallback方法。 代码:

 @Override
public View getItemView(Campaign campaign, View v, ViewGroup parent) {


    if (v == null) {
        v = View.inflate(getContext(), R.layout.list_single, null);
    }

    super.getItemView(campaign, v, parent);
    ParseImageView mealImage = (ParseImageView) v.findViewById(android.R.id.icon);
    progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
    ParseFile photoFile = campaign.getImage();
    if (photoFile != null) {
        mealImage.setParseFile(campaign.getImage());
        mealImage.loadInBackground(new GetDataCallback() {
                                       @Override
                                       public void done(byte[] data, ParseException e) {
                                           // nothing to do

                                       }
                                   }
                , new ProgressCallback() {
                    @Override
                    public void done(Integer percentDone) {
                        progressBar.setVisibility(View.VISIBLE);
                        progressBar.setProgress(percentDone);
                    }

                }

        )

    }
    if (photoFile == null) {
        mealImage.setImageResource(R.drawable.default_icon);

    }

    TextView titleTextView = (TextView) v.findViewById(R.id.title);
    titleTextView.setText(campaign.getTitle());
    TextView descriptionTextView = (TextView) v
            .findViewById(R.id.description);
    descriptionTextView.setText(campaign.getDescription());
    return v;

}

我得Cannot resolve method loadInBackground(anonymous com.parse.getDataCallback, anonymous com.parse.ProgressCallback) 那么,loadInBackground()不包含ProgressCallback吗?如果是这样,我如何根据加载量来设置进度条的百分比?

1 个答案:

答案 0 :(得分:0)

loadInBackground函数不包含进度回调。您应该使用getDataInBackground代替