Multiple choice

How can we add the tabs and their listeners to the action bar?

  1.      Tab t1=bar.newTab();
          t1.setText("Tab Text&");
    
  2.     Tab t1=bar.newTab();
        t1.setTabListener(this);
    
  3.             Tab t1=bar.newTab();
                t1.setText("Tab Text");
                t1.setTabListener(this);
    
  4.            Tab t1=bar.newTab();
                t1.setText("Tab Text");
                t1.setTabListener(this);
                bar.addTab(bar.newTab());
    
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The code to add the tabs and their listeners to the action bar is as follows:

            t1.setText("Tab Text");
            t1.setTabListener(this);
            bar.addTab(bar.newTab());