Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OpenTabsActivity extends AppCompatActivity {
- private LinearLayout buttons;
- private int tabno = -1;
- private Intent in;
- private Intent settings;
- private ArrayList<Button> list;
- private Button newTab;
- private Context ctx;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_open_tabs);
- setSupportActionBar((Toolbar)findViewById(R.id.toolbar));
- buttons = findViewById(R.id.scroll_linear);
- in = new Intent();
- settings = new Intent();
- list = new ArrayList<Button>();
- newTab = findViewById(R.id.newtab);
- ctx = this;
- newTab.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Button n = new Button(ctx);
- list.add(n);
- tabno += 1;
- Button nB = list.get(tabno);
- nB.setText(getText(R.string.newtab));
- // nB.id = tabno
- buttons.addView(nB);
- }
- });
- }
- // ...
- }
Add Comment
Please, Sign In to add comment