質問編集履歴

2

MainActivityに変更を加えました

2023/01/24 05:36

投稿

syosinsya109
syosinsya109

スコア41

test CHANGED
File without changes
test CHANGED
@@ -137,9 +137,10 @@
137
137
  switch(view.getId()) {
138
138
  case R.id.edit:
139
139
  Button button = view.findViewById(R.id.edit);
140
- button.setOnClickListener((View v) -> {
141
- System.out.println(Long.parseLong(cursor.getString(columnIndex)));
140
+ long id = Long.parseLong(cursor.getString(columnIndex));
141
+ if(id % 2 == 1){
142
+ ((ViewGroup)button.getParent()).setBackgroundColor(Color.rgb(127, 127, 255));
142
- });
143
+ }
143
144
  return true;
144
145
  }
145
146
  return false;

1

MainActivityのプログラムを修正しました

2023/01/23 15:56

投稿

syosinsya109
syosinsya109

スコア41

test CHANGED
File without changes
test CHANGED
@@ -133,6 +133,7 @@
133
133
  private class ViewBinder implements SimpleCursorAdapter.ViewBinder {
134
134
  @Override
135
135
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
136
+ long id = Long.parseLong(cursor.getString(columnIndex));
136
137
  switch(view.getId()) {
137
138
  case R.id.edit:
138
139
  Button button = view.findViewById(R.id.edit);