不兼容的类型:对象无法转换为ParseObject

时间:2015-05-11 02:33:48

标签: java android parsing android-listview

我正在使用Parse对我的应用程序进行一些整理。为了用解析对象填充LitsView,我使用了以下适配器类。问题是,我在

收到错误
ParseObject statusObject = mStatus.get(position);

错误读取:错误:(44,47)错误:不兼容的类型:对象无法转换为ParseObject

这里发生了什么?

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.parse.ParseObject;

import java.util.List;

public class StatusAdapter extends ArrayAdapter {
protected Context mContext;
protected List mStatus;

public StatusAdapter(Context context, List status) {
    super(context, R.layout.homepage, status);
    mContext = context;
    mStatus = status;
}

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(
                R.layout.homepage, null);
        holder = new ViewHolder();
        holder.usernameHomepage = (TextView) convertView
                .findViewById(R.id.usernameHP);
        holder.statusHomepage = (TextView) convertView
                .findViewById(R.id.statusHP);

        convertView.setTag(holder);
    } else {

        holder = (ViewHolder) convertView.getTag();

    }

    ParseObject statusObject = mStatus.get(position);

    // title
    String username = statusObject.getString("user");
    holder.usernameHomepage.setText(username);

    // content
    String status = statusObject.getString("newStatus");
    holder.statusHomepage.setText(status);

    return convertView;
}

public static class ViewHolder {
    TextView usernameHomepage;
    TextView statusHomepage;

}

}

0 个答案:

没有答案