title: How to show ListView in Tab?
body: <p>I want to display ListView in Tab (after selecting this tab I want ListView to appear),so I have created Fragment class and placed ListView code in it.The main problem now is to pass fragment object to tabListener. Please, post here example, or even better show how to do that in my code. Anyway, any help will be appreciated.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main); 
  
          ActionBar actionBar = getActionBar();
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
          ActionBar.Tab tabOne = actionBar.newTab().setText("One");
          ActionBar.Tab tabTwo = actionBar.newTab().setText("Two");
  
  
          tabOne.setTabListener(new tabListener());
          tabTwo.setTabListener(new tabListener());
  
          actionBar.addTab(tabOne);
          actionBar.addTab(tabTwo);   
          } 
  
  
      protected class tabListener implements ActionBar.TabListener {
  
          @Override
          public void onTabUnselected(Tab tab, FragmentTransaction ft) {
  
          }
  
          @Override
          public void onTabSelected(Tab tab, FragmentTransaction ft) {
  
          }
  
          @Override
          public void onTabReselected(Tab tab, FragmentTransaction ft) {
  
          }
      };
  
      public class FirstFragment extends ListFragment {
          private ArrayList&lt;Cinemas&gt; cinema;
          private CinemasAdapter cinemaAdapter;
          private ListView list;
  
            @Override
            public void onActivityCreated(Bundle savedInstanceState) {
              super.onActivityCreated(savedInstanceState);
              cinema = new Handler().handle(); 
              cinemaAdapter = new CinemasAdapter(MainActivity.this, R.layout.movie_data_row, cinema);
              setListAdapter(cinemaAdapter);
            }
  
            @Override
            public void onListItemClick(ListView l, View v, int position, long id) {
                Cinemas movie = cinemaAdapter.getItem(position);
                  Intent intent = new Intent (MainActivity.this, More.class);
                  intent.putExtra("Cinemas", movie);
                  intent.putExtra("data", movie.getBitmap());
  
                  Bundle translateBundle =
                        ActivityOptions.makeCustomAnimation(MainActivity.this,
                        R.anim.slide_in_left, R.anim.slide_out_left).toBundle();
                startActivity (intent, translateBundle);
            }
          } 
  
  }
  </code></pre>