title: Make a custom listView for fragments?
body: <p>I trying to build an app with 4 tabs. Every tab has a different fragment linked to it. The issue is that I want to make a custom listView for each fragment, but it ends with some unsolvable error... I have talked to other developers, but I still can't make one that works! It's really frustrating!</p>
  
  <p><strong>I have:</strong></p>
  
  <ul>
  <li>A MainActivity class that works, it uses swipe-able tabs</li>
  <li>An XML with the design I want on my custom ListView.</li>
  <li>An XML called fragment1 with a ListView.</li>
  </ul>
  
  <p><strong>These are normal errors I get:</strong> </p>
  
  <ul>
  <li>"The method findViewById(int) is undefined for the type Fragment1UG"</li>
  <li>"The method setContentView(int) is undefined for the type Fragment1UG. 1 quick fix available: Create method 'setContentView()'"</li>
  </ul>
  
  <p>One of the guides I'm trying to understand and use: </p>
  
  <ul>
  <li><a href="http://javatechig.com/android/android-listview-tutorial/#3_Building_ListViewusing_Custom_Adapter" rel="nofollow">Android ListView Tutorial</a> </li>
  <li><a href="http://www.vogella.com/articles/AndroidListView/article.html" rel="nofollow">Android ListFragment Tutorial</a></li>
  </ul>
  
  <p>This is my 1st fragment:</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ListView;
  
  public class Fragment1test extends Fragment {
      public View onCreateView(LayoutInflater inflater, ViewGroup container, 
              Bundle savedInstanceState) {
              // Inflate the layout for this fragment
              //This layout contains your list view 
                  View view = inflater.inflate(R.layout.fragment1, container, false);
  
                 //now you must initialize your list view
                  ListView yourListView = (ListView)view.findViewById(R.id.ListView1);
                  ListView.setAdapter(new ListAdapter());
                return view;
      }
  }
  </code></pre>
  
  <p>My ListAdapter.java code (from a tutorial):</p>
  
  <pre><code>import java.util.List;
  
  import android.content.ClipData.Item;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.TextView;
  
  public class ListAdapter extends ArrayAdapter&lt;Item&gt; {
  
  public ListAdapter(Context context, int textViewResourceId) {
      super(context, textViewResourceId);
      // TODO Auto-generated constructor stub
  }
  
  private List&lt;Item&gt; items;
  
  public ListAdapter(Context context, int resource, List&lt;Item&gt; items) {
  
      super(context, resource, items);
  
      this.items = items;
  
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
  
      View v = convertView;
  
      if (v == null) {
  
          LayoutInflater vi;
          vi = LayoutInflater.from(getContext());
          v = vi.inflate(R.layout.list_design, null);
  
      }
  
      Item p = items.get(position);
  
      if (p != null) {
  
          TextView tt = (TextView) v.findViewById(R.id.game_txtTitle);
          TextView tt1 = (TextView) v.findViewById(R.id.game_txtRelease);
          TextView tt3 = (TextView) v.findViewById(R.id.game_txtPlatform);
  
          if (tt != null) {
              tt.setText(p.getId());
          }
          if (tt1 != null) {
  
              tt1.setText(p.getCategory().getId());
          }
          if (tt3 != null) {
  
              tt3.setText(p.getDescription());
          }
      }
  </code></pre>