0
저는 iOS 개발자 였고 Android 프로젝트를 시작으로 작업했습니다. 하루 동안 다음 호에 갇혔습니다. 도움을 좀주세요.커서에 데이터가 있지만 ListFragment가 빈보기 만 표시합니다.
another stack question으로 복제 될 수도 있지만 아무도 그 질문에 답변하지 않았습니다.
내 문제는 다음 코드에서 발생했습니다. log.d는 실제로 커서에 데이터가 있음을 나타내지 만 listfragment는 항상 빈 뷰를 표시합니다.
여기가 ImagesListAdapter
public class ImagesListAdapter extends SimpleCursorAdapter {
private static final String TAG = ImagesListAdapter.class.getSimpleName();
static final String[] from = new String[] {ImageData.C_LINK_URL };
static final int[] to = new int[] { R.id.coupon_lbl};
// Constructor
public ImagesListAdapter(Context context, Cursor c) {
super(context, R.layout.image_cell, c, from, to, 0);
}
// This is where the actual binding of a cursor to view happens
@Override
public void bindView(View row, Context context, Cursor cursor) {
super.bindView(row, context, cursor);
// Manually bind created at timestamp to its view
Log.d(TAG,"binding View.");
String link = cursor.getString(cursor.getColumnIndex(ImageData.C_LINK_URL));
TextView textCreatedAt = (TextView) row.findViewById(R.id.coupon_lbl);
textCreatedAt.setText(link);
}
}
나는이 디버깅을 시작하여야에게 무엇입니까?
ImagesListAdapter의 우편 번호. –
안녕하세요, Giru Bhai, 몇 가지 코드로 질문을 업데이트했습니다. 회신 해 주셔서 감사합니다. –
'super.bindView'가 이미 텍스트를 설정해야합니다. 왜 그것을 무시하고 슈퍼 콜 후에 수동으로 설정하려고합니까? 또한,'bindView'가 호출되고 있는지 확인하고'row.findViewById'를 호출 할 때 textview가 반환되고 image_cell 레이아웃에 포함되어 있는지 확인하십시오. – Chris