title: Custom listview inside of a fragment
body: <p>I am using a fragment to display a custom listview. The problem is that it doesnt show.  But if a I use a normal listview it works.  I know that I  can use a listfragment. But  I need some buttons that there are in fragment layout.</p>
  
  <p>And Also I manage the framents with a tabHost.</p>
  
  <pre><code>class Contactos extends Fragment 
  
  private ListView lstContactos;
  private AdLstContactos adListaContactos;
  
  @Override
  public void onActivityCreated(Bundle state) {
      super.onActivityCreated(state);
      displayListView();
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setRetainInstance(true);
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      if(container == null){
          return null;
      }
      return inflater.inflate(R.layout.activity_contactos, container, false);
  }
  
  // Aqui se hace los findview
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
  
      // lstContactos = (ListView)view.findViewById(R.id.lstContactos);
  
      // adLstContatos = new LstContactos(view.getContext());
  
      // lstContactos.setAdapter(adLstContatos);
  }
  
  private void displayListView() {
  
      // create an ArrayAdaptar from the String Array
      adListaContactos = new AdLstContactos(getActivity().getApplicationContext());
      ListView listView = (ListView) getActivity()
              .findViewById(R.id.lstContactos);
      // Assign adapter to ListView
      listView.setAdapter(adListaContactos);
  }
  
  
  public class AdLstContactos extends ArrayAdapter&lt;String&gt;
  
  private Context context;
  private  ArrayList&lt;Contactos&gt; datos;
  private  List&lt;String&gt; urlList;
  private TextView txtNombre, txtNumero;
  
  public AdLstContactos(Context contexto) {
      super(contexto, R.layout.adaptador_lst_contactos);
      this.context = contexto;
      //this.datos = datos;
      urlList = new ArrayList&lt;String&gt;();
        urlList.add("test1");
        urlList.add("test1");
        urlList.add("test1");
  }
  
   @Override
  public View getView(int position, View convertView, ViewGroup parent) {
          // Create a new view into the list.
          LayoutInflater inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View rowView = inflater.inflate(R.layout.adaptador_lst_contactos, parent, false);
  
          txtNombre = (TextView)rowView.findViewById(R.id.txtNombreC);
          txtNumero = (TextView)rowView.findViewById(R.id.txtNumeroC);
  
          txtNombre.setText(urlList.get(position));
  
          txtNumero.setText(urlList.get(position));
          System.out.println("getView");
  
      return rowView;
  }
  </code></pre>
  
  <p>Main activitvy</p>
  
  <pre><code>private FragmentTabHost mTabHost;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      mTabHost = new FragmentTabHost(this);
      setContentView(mTabHost);
  
      mTabHost.setup(this, getSupportFragmentManager(),
              R.layout.activity_principal);
      mTabHost.addTab(mTabHost.newTabSpec("DatosPersonales")
              .setIndicator("Your Info"),DatosPersonales.class,null);
  
      mTabHost.addTab(mTabHost.newTabSpec("Contactos")
              .setIndicator("Contacts"),Contactos.class,null);
  }
  </code></pre>
  
  <p>xml Contactos</p>
  
  <pre><code>&lt;Button
      android:id="@+id/button1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:text="Button" /&gt;
  
  &lt;ListView
      android:id="@+id/lstContactos"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignLeft="@+id/button1"
      android:layout_below="@+id/button1" &gt;
  &lt;/ListView&gt;
  </code></pre>