0

I am developing an android attendance system in which the user enters the total number(int) of students in a class in Main_Activity and that many numbers of buttons are created in 2nd activity. How can I use the user input to create a list of buttons (used to mark present or absent) during runtime.

Code to save Int value

EditText total_roll_Name   = (EditText) findViewById(R.id.roll_total_input);
String total_roll_text = total_roll_Name.getText().toString();

i.putExtra("totalRoll", total_roll_text);
Ved Sarkar
  • 347
  • 2
  • 8
  • 18

2 Answers2

1

Create button run time by below code and add into linear layout

Button dButton= new Button(this);
             myButton.setText("Add Me");

             LinearLayout lay= (LinearLayout)findViewById(R.id.buttonlayout);
             LayoutParams layPar= new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
             lay.addView(dButton, layPar);
vishal jangid
  • 2,967
  • 16
  • 22
0

i think you need attendance module right?.you have all student roll no in database.if you have then get a data from database in custom listview with checkbox and you can easily mark or unmark present or not.i already developed this type of system.if you need then i send you.

Sagar Patel
  • 224
  • 1
  • 9