저는 직원 출석을 표시하고 데이터베이스에 저장해야하는 프로젝트에서 작업하고 있습니다. 그 이유는 직원이 있는지 여부를 결정하는 라디오 그룹의 라디오 버튼을 구현했기 때문입니다 부재중 또는 반나절에 ....이 작업을 수행하려면 목록보기에서 해당 값을 가져와 완료 버튼을 클릭해야합니다. 출석은 표시하고 데이터베이스에 저장해야합니다.listview에서 라디오 버튼 값을 처리하는 방법
내 문제는 어떻게 얻을 수 있습니까? 그 값은 내 사용자 지정 목록보기에서 해당 라디오 버튼을 처리하고 그 데이터를 처리합니다 !! ??
사용자 지정 목록 어댑터에 대한 내 코드
public class CustomCalendarAdapter extends ArrayAdapter<String> {
private final Activity context;
private final String[] itemname;
private final Bitmap[] imgid;
public CustomCalendarAdapter(Activity context, String[] itemname, Bitmap[] imgid) {
super(context, R.layout.list_item2, itemname);
this.context=context;
this.itemname=itemname;
this.imgid=imgid;
}
@Nonnull
public View getView(int position, View view,@Nonnull ViewGroup parent) {
LayoutInflater inflater=context.getLayoutInflater();
View rowView=inflater.inflate(R.layout.list_item2, null,true);
TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
TextView extratxt = (TextView) rowView.findViewById(R.id.textView1);
final RadioButton rb1 = (RadioButton) rowView.findViewById(R.id.rb1);
final RadioButton rb2 = (RadioButton) rowView.findViewById(R.id.rb2);
final RadioButton rb3 = (RadioButton) rowView.findViewById(R.id.rb3);
rb2.setChecked(true);
txtTitle.setText(itemname[position]);
imageView.setImageBitmap(imgid[position]);
extratxt.setText("Description "+itemname[position]);
return rowView;
} }
목록보기 XML에 대한 나의 코드
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/icon"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/rowselector"
android:padding="5dp" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="80dp"
android:layout_weight="1"
android:background="@drawable/rowselector"
android:orientation="vertical">
<TextView
android:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:padding="2dp"
android:textColor="#000" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<RadioGroup
android:id="@+id/rg"
android:orientation="horizontal"
android:layout_marginTop="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/rb1"
android:text="P"
android:padding="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/rb2"
android:text="A"
android:padding="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<RadioButton
android:id="@+id/rb3"
android:text="HD"
android:padding="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RadioGroup>
내가 목록을 표시하고 완료를 처리하고자하는 목록보기와 활동에 대한 내 코드 버튼
public class Attendance extends AppCompatActivity {
CustomCalendarAdapter adapter;
ArrayList<String> strings = new ArrayList<>();
ArrayList<Bitmap> bitmaps = new ArrayList<>();
ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendance);
lv = (ListView) findViewById(R.id.list);
myinfodbhelper mDbHelper = new myinfodbhelper(this);
SQLiteDatabase db = mDbHelper.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT * FROM "
+ myinfocontract.myinfoentry.TABLE_NAME,null);
while (cursor.moveToNext()) {
String currentfname = cursor.getString(cursor.getColumnIndex("name"));
byte[] bytes = cursor.getBlob(cursor.getColumnIndex("image"));
Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
strings.add(currentfname);
bitmaps.add(bitmap);
}
cursor.close();
String[] itemname = strings.toArray(new String[0]);
Bitmap[] imageid = bitmaps.toArray(new Bitmap[0]);
adapter = new CustomCalendarAdapter(this, itemname, imageid);
lv.setAdapter(adapter);
lv.setEmptyView(tv);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.floatingActionButton);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Here I want to handle the radio button check
//And mark done by the floatingActionButton id in my listview xml file
}
});
이 질문에 대한 답변이 제공 되었다면 pls 제공 링크
나는이 질문을하므로 저의 질문에 iam에게 관련있는 해결책을 찾을 수 없습니다. 무엇 修正을해야합니까 ?? 사전에
들으 ...