这是我的片段,我将信息放在列表视图中
@Override
public void onViewBind(View view, Cursor cursor, ODataRow row) {
OControls.setText(view, R.id.name, row.getString("name"));
OControls.setText(view, R.id.email, row.getString("message"));
(ligne 131) ODataRow resPartnerRow =
row.getM2ORecord("student_id").browse();
OControls.setText(view, R.id.company_name, resPartnerRow.getString("Name"));
}
这是我从表中检索信息的类
public class Sanction extends OModel {
public static final String TAG = Sanction.class.getSimpleName();
public static final String AUTHORITY = "com.odoo.Etudiant";
OColumn message = new OColumn("message", OText.class).setRequired();;
OColumn type_id= new OColumn("type_id", typee.class,
OColumn.RelationType.ManyToOne);
OColumn student_id = new OColumn("Name", ResPartner.class,
OColumn.RelationType.ManyToOne);
他给我看
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ClassCastException: java.lang.Integer cannot be cast to
com.odoo.core.orm.OM2ORecord
at
com.odoo.core.orm.ODataRow.getM2ORecord(ODataRow.java:69)
at
com.odoo.Etudiant.Student.onViewBind(PersonFragement.java:131)
我该怎么做才能显示名称而不是 id