Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Button button1 = new Button(this);
- for (int x = 1; x <= 4; x++) {
- Button button1 = new Button(this);
- }// something like this
- LinearLayout layout = findViewById(R.id.yourlayout);
- List<Button> list = new ArrayList<>();
- for (int x = 1; x <= 4; x++) {
- Button button = new Button(this);
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- // code
- }
- });
- list.add(button);
- layout.addView(button);
- }
Add Comment
Please, Sign In to add comment