title: The activity is blank something wrong with the custom gird Adapter code?
body: <p>I'm testing a simple grid adapter with a custom object, the app runs on the device without a problem but stays blank instead of inflating the activity with the specified grid items. This is my code.</p>
  
  <p><strong>Main Activity</strong></p>
  
  <pre><code>package com.example.nobodyme.errorrepository;
  
    import android.app.Activity;
    import android.os.Bundle;
    import android.support.v7.app.ActionBarActivity;
    import android.widget.AdapterView;
    import android.widget.ArrayAdapter;
    import android.widget.GridView;
    import android.widget.TextView;
    import android.widget.Toast;
    import android.view.View;
    import android.widget.AdapterView.OnItemClickListener;
  
    import java.util.ArrayList;
  
    public class MainActivity extends ActionBarActivity {
  
    GridView gridView;
  
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  
    setContentView(R.layout.activity_main);
  
    ArrayList&lt;GridItems&gt; gridItems = new ArrayList&lt;&gt;();
    gridItems.add(new GridItems("Android", 2));
    gridItems.add(new GridItems("Java", 3));
  
    gridView = (GridView) findViewById(R.id.gridView1);
  
    gridView.setAdapter(new GridViewAdapter(this, gridItems));
  
  
  
    }
  
    }
  </code></pre>
  
  <p><strong>GridViewAdapter</strong></p>
  
  <pre><code>    package com.example.nobodyme.errorrepository;
  
      import android.content.Context;
      import android.view.LayoutInflater;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.ArrayAdapter;
      import android.widget.TextView;
  
      import java.util.List;
  
  
  
      public class GridViewAdapter extends ArrayAdapter&lt;GridItems&gt; {
  
          private Context context;
          int b;
  
          public GridViewAdapter(Context context, List&lt;GridItems&gt; gridItems) {
              super(context, 0, gridItems);
              b=gridItems.size();
          }
  
          public View getView(int position, View convertView, ViewGroup parent) {
  
              View gridView = convertView;
  
              if(gridView == null)
              {
  
                  gridView = LayoutInflater.from(getContext()).inflate(
                                             R.layout.grid_view, parent, false);
  
              }
  
              GridItems currentgriditem = getItem(position);
  
              TextView mMaintextView = (TextView) gridView.findViewById(R.id.grid_item_main);
              mMaintextView.setText(currentgriditem.getTitle());
  
  
              TextView mUnansweredtextView = (TextView) gridView.findViewById(R.id.grid_item_unanswered);
              mUnansweredtextView.setText(currentgriditem.getUnansweredNo());
  
  
              return gridView;
  
          }
  
          @Override
          public int getCount() {
              return b;
          }
  
  
          @Override
          public long getItemId(int position) {
              return 0;
          }
  
      }
  </code></pre>
  
  <p><strong>GridItems</strong></p>
  
  <pre><code>package com.example.nobodyme.errorrepository;
  
  /**
   * Created by nobodyme on 15/1/17.
   */
  
  public class GridItems {
  
      /** Grid title*/
      private String mTitle;
  
      /** NO of unanswered items in the gird **/
      private Integer mUnansweredNo;
  
      public GridItems(String Title, Integer UnansweredNo) {
          mTitle = Title;
          mUnansweredNo = UnansweredNo;
      }
  
  
  
      public String getTitle() {
          return mTitle;
      }
  
  
      public Integer getUnansweredNo() {
          return mUnansweredNo;
      }
  
  
  }
  </code></pre>
  
  <p>I have edited the code as per the comments and the app still crashes.</p>