これには GridView と SimpleCursorAdapter があります。コードは次のようになります
GridView myGridView = (GridView) this.freePassDialog.findViewById(R.id.gridview_buttons);
String[] column = { "name", "type" };
int[] viewIds = new int[] { R.id.name_button, R.id.type_button };
SimpleCursorAdapter myCursorAdapter = new SimpleCursorAdapter(this.parent, R.layout.row_free_pass_buttons, cursor, column, viewIds) {
/**
* {@inheritDoc}
* @see android.widget.SimpleCursorAdapter#bindView(android.view.View, android.content.Context, android.database.Cursor)
*/
@Override
public void bindView(View view, Context context, Cursor cursor) {
String freePassName = cursor.getString(cursor.getColumnIndex("name"));
String freePassType = cursor.getString(cursor.getColumnIndex("type"));
Button freePassBtn = (Button) view.findViewById(R.id.pass_name_button);
if (PaymentMethodType.SMARTCARD_PASS == PaymentMethodType.valueOf(freePassType)) {
freePassBtn.setVisibility(View.GONE);
} else {
freePassBtn.setVisibility(View.VISIBLE);
}
super.bindView(view, context, cursor);
}
};
myGridView.setAdapter(myCursorAdapter);
カーソルには4つの値がありますが、ロガーをBindViewメソッドに入れると、最初の値だけが数回来ます誰か助けてもらえますか? ありがとう