mercredi 28 janvier 2015

Android. A public constructor with no arguments

When i try to export this project to my android device, there is a problem occur in my constructor that used for custom cursor adapter... Anyone can tell me why this occur?



*My CursorAdapterActivity.java
public class CursorAdapterActivity extends CursorAdapter {

public CursorAdapterActivity(Context context, Cursor c) {
super(context, c);
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
// when the view will be created for first time,
// we need to tell the adapters, how each item will look
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View retView = inflater.inflate(R.layout.list_shipments, parent, false);

return retView;
}

@Override
public void bindView(View view, Context context, Cursor cursor) {

//Assign data to each textview in list_shipments.xml
TextView tvClientReferenceNo = (TextView) view.findViewById(R.id.tv_client_reference_no);
tvClientReferenceNo.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(2))));

TextView tvContactPerson = (TextView) view.findViewById(R.id.tv_contactPersonNno);
tvContactPerson.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(7))) + " (" + cursor.getString(cursor.getColumnIndex(cursor.getColumnName(6)))+")");

TextView tvDestinationName = (TextView) view.findViewById(R.id.tv_destinationName);
tvDestinationName.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(8))));


}
}

Aucun commentaire:

Enregistrer un commentaire