I am developing an app for attendance. So I want to retrieve my roll no. and name data from my database and display it in a table layout and add 2 radio buttons (present and absent) with each record, but I am unable to do so.
This is my code:
package com.example.attendance;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
public class Take_attendance1 extends AppCompatActivity {
TextView st_roll,st_name;
Databases db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_take_attendance1);
db = new Databases(this);
st_roll = (TextView)findViewById(R.id.st_roll1);
st_name = (TextView)findViewById(R.id.st_name1);
String course = getIntent().getStringExtra("coursesel");
String sem = getIntent().getStringExtra("semsel");
db = new Databases(this);
StringBuilder stringBuilder[] = db.getStudentData(course,sem);
st_roll.setText(stringBuilder[1]); //for roll no
st_name.setText(stringBuilder[2]); //for name
}
}
Here is the snapshot of my app:
Now I want radio buttons for all my records, but it is showing only for the first one.