title: How to access setAdapter in Fragment class?
body: <p>I have a following <code>Fragment</code> class:</p>
  
  <pre><code>public class TabFragment extends Fragment {
    ....
   @Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
     {
       View view =  inflater.inflate(R.layout.fragment_photos_tab, container, false);
       TabelAdapter adapt = new TabelAdapter(getActivity().getApplicationContext(), R.layout.list_room_view, flowerList);
       setListAdapter(adapt);     // Not Working because class is not extended by ListActivity
       return view;
     }
  </code></pre>
  
  <h1>TabelAdapter class</h1>
  
  <pre><code>public class TabelAdapter extends ArrayAdapter&lt;Flower&gt; {
  
   @Override
   public View getView(int position, View convertView, ViewGroup parent) {
     LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
     if (null == convertView) {
          convertView = inflater.inflate(R.layout.list_flower_view, parent, false);
      }
      Picasso
              .with(context)
              .load("http://i.imgur.com/rFLNqWI.jpg")
              .fit()
              .into((ImageView) convertView);
      return convertView;
  }
  </code></pre>
  
  <h1>list_flower_view.xml</h1>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;ImageView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/Flowerimg"
      android:layout_width="match_parent"
      android:layout_height="200dp"/&gt;
  </code></pre>
  
  <h1>activity_home.xml</h1>
  
  <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
  android:layout_height="match_parent" tools:context=".MainActivity"&gt;
  
  &lt;ListView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@android:id/list"&gt;&lt;/ListView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>When I was working with <code>activity</code> instead of <code>fragment</code> then the whole process was very simple. I extend <code>MainActivity</code> class with <code>ListActivity</code> and add <code>setContentView(R.layout.activity_home);</code> into <code>MainActivity.OnCreate()</code>. I can see the list of Images in <code>ListView</code>.</p>
  
  <h1>Question</h1>
  
  <p>How to make <code>setListAdapter</code> usable in <code>Fragment</code> class? I am newbie in <code>Android</code>. Any help will be appreciable :)</p>
  
  <h1>Edit-1</h1>
  
  <pre><code>public class PagerAdapter extends FragmentStatePagerAdapter {
  int mNumOfTabs;
  
  public PagerAdapter(FragmentManager fm, int NumOfTabs) {
      super(fm);
      this.mNumOfTabs = NumOfTabs;
  }
  
  @Override
  public Fragment getItem(int position) {
  
      switch (position) {
          case 0:
              TabFragment photo = new TabFragment();
              return photo;  // Line (30,24)
    }        ......
   }
  </code></pre>
  
  <p>If I use <code>ListFragment</code> instead of <code>Fragment</code> then <code>PagerAdapter</code> class os throwing an Error. </p>
  
  <pre><code>Error:(30, 24) error: incompatible types: TabFragment cannot be converted to Fragment
  </code></pre>
  
  <h1>Edit-2</h1>
  
  <pre><code>java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
  </code></pre>