title: Change listview layout if empty
body: <p>I use an adapter to set the item layout and to populate a <code>ListView</code> from a JSON string. Sometimes this JSON is empty and there aren't any rows into the <code>ListView</code> and it's full blank.</p>
  
  <p>In this case, I want to change the view and pass another layout showing "There aren't any rows here".</p>
  
  <p>So this is my code:</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          ListView listView = (ListView) findViewById(R.id.listView);
          List list = new LinkedList();
  
          [...fill list...]
  
          ListAdapter adapter = new ListAdapter(this, R.layout.list_row_layout, list, R.id.edCod, R.id.edDes);
          listView.setAdapter(adapter);
      }
  }
  </code></pre>
  
  <p><strong>ListAdapter.java</strong></p>
  
  <pre><code>public class ListAdapter extends ArrayAdapter&lt;Adapter&gt; {
      private LayoutInflater layoutInflater;
      private int layout;
      private int textCod;
      private int textDes;
  
      public FruttaAdapter(Context context, int layout, List&lt;Adapter&gt; objects, int textCod, int textDes) {
          super(context, layout, objects);
  
          this.layout = layout;
          this.textCod = textCod;
          this.textDes = textDes;
          layoutInflater = LayoutInflater.from(context);
      }
  </code></pre>