daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest May 16th, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class OpenTabsActivity extends AppCompatActivity {
  2.  private LinearLayout buttons;
  3.  private int tabno = -1;
  4.  private Intent in;
  5.  private Intent settings;
  6.  private ArrayList<Button> list;
  7.  private Button newTab;
  8.  private Context ctx;
  9.  
  10.  @Override
  11.  public void onCreate(Bundle savedInstanceState) {
  12.      super.onCreate(savedInstanceState);
  13.      setContentView(R.layout.activity_open_tabs);
  14.      setSupportActionBar((Toolbar)findViewById(R.id.toolbar));
  15.      buttons = findViewById(R.id.scroll_linear);
  16.      in = new Intent();
  17.      settings = new Intent();
  18.      list = new ArrayList<Button>();
  19.      newTab = findViewById(R.id.newtab);
  20.      ctx = this;
  21.  
  22.      newTab.setOnClickListener(new View.OnClickListener() {
  23.          @Override
  24.          public void onClick(View v) {
  25.              Button n = new Button(ctx);
  26.              list.add(n);
  27.              tabno += 1;
  28.              Button nB = list.get(tabno);
  29.              nB.setText(getText(R.string.newtab));
  30.              // nB.id = tabno
  31.              buttons.addView(nB);
  32.          }
  33.      });
  34.  }
  35. // ...
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top