title: GridView with ListActivity
body: <p>I'm trying to make a GridView work in place of a Listview. The code uses a ListActivity, here it is below:</p>
  
  <pre><code>public class BorrowerList extends ListActivity implements
  LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
  
  private static final int ACTIVITY_PERSON_UPCLOSE = 3;
  
  private SimpleCursorAdapter adapter;
  
  // -----------------------------------------------------------
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.grid_view_person_record);
      this.getListView().setDividerHeight(2);
      fillData();
  }
  
  
  
  // -----------------------------------------------------------
  
  
  
  private void fillData() {
      // TODO Auto-generated method stub
  
      String[] from = new String[] { BorrowMeTable.COLUMN_NAME };     
  
      int[] to = new int[] { R.id.pername};
  
      getLoaderManager().initLoader(0, null, this);
      adapter = new SimpleCursorAdapter(this, R.layout.grid_view_rowitem, null, from,
              to, 0);
  
      setListAdapter(adapter);
  
  }
  
  // -----------------------------------------------------------
  
  
  @Override
  protected void onRestart() {
      // TODO Auto-generated method stub
      super.onRestart();
      //fillData();
  }
  
  
  // -----------------------------------------------------------
  
  
  @Override
  public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle args) {
      // Remove to show all records
      //String mSelection = BorrowMeTable.COLUMN_NAME + "=?"; // SQL request
      //String[] selectionArgs = {"Jack Reacher"}; // The actual argument
  
      BorrowMeContentProvider.distinctSwitch = true;
  
  
      String[] projection = { BorrowMeTable.COLUMN_ID, BorrowMeTable.COLUMN_NAME };
  
  
      CursorLoader cursorLoader = new CursorLoader(this,
          BorrowMeContentProvider.CONTENT_URI, projection, null, null, null);
  
  
      return cursorLoader;
  }
  
  // -----------------------------------------------------------
  
  @Override
  public void onLoadFinished(Loader&lt;Cursor&gt; arg0, Cursor arg1) {
      // TODO Auto-generated method stub
      adapter.swapCursor(arg1);
  
  
  }
  
  // -----------------------------------------------------------
  
  @Override
  public void onLoaderReset(Loader&lt;Cursor&gt; arg0) {
      // TODO Auto-generated method stub
      adapter.swapCursor(null);
  
  }
  
  // -----------------------------------------------------------
  
  protected void onListItemClick(ListView l, View v, int position, long id) {
      super.onListItemClick(l, v, position, id);
  
      // When Clicked - loads record ID and sends it to PersonRecord class
  
      Intent i = new Intent(this, PersonRecord.class);
  
      // Sends a URI request to the content provider saying we are looking for a
      // particular record
      Uri borrowUri = Uri.parse(BorrowMeContentProvider.CONTENT_URI + "/" + id);
      i.putExtra(BorrowMeContentProvider.CONTENT_ITEM_TYPE, borrowUri);
  
      // Activity returns an result if called with startActivityForResult
      // startActivityForResult(i, ACTIVITY_PERSON_UPCLOSE);
  
      // Removed the for Result as it would not allow the previous activity
      // to release, so it would live people on the list even if all records had been deleted
  
      startActivity(i);
  
  }
  
  }
  </code></pre>
  
  <p>I ask a previous question on the stackoverflow and I got a simple "Replace ListView with GridView - which could be entirely correct - but I haven't quite got it yet.</p>
  
  <p>Here is the error message I get:</p>
  
  <pre><code>09-15 18:30:43.169: E/AndroidRuntime(1081): FATAL EXCEPTION: main
  09-15 18:30:43.169: E/AndroidRuntime(1081): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fthatnoise.borrow.me/com.fthatnoise.borrow.me.BorrowerList}: android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.GridView
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.os.Looper.loop(Looper.java:137)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at java.lang.reflect.Method.invoke(Method.java:511)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at dalvik.system.NativeStart.main(Native Method)
  09-15 18:30:43.169: E/AndroidRuntime(1081): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.GridView
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.Activity.setContentView(Activity.java:1881)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at com.fthatnoise.borrow.me.BorrowerList.onCreate(BorrowerList.java:39)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.Activity.performCreate(Activity.java:5104)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     ... 11 more
  09-15 18:30:43.169: E/AndroidRuntime(1081): Caused by: java.lang.reflect.InvocationTargetException
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at java.lang.reflect.Constructor.constructNative(Native Method)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     ... 24 more
  09-15 18:30:43.169: E/AndroidRuntime(1081): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x3
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.View.&lt;init&gt;(View.java:3340)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:431)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.widget.AdapterView.&lt;init&gt;(AdapterView.java:235)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.widget.AbsListView.&lt;init&gt;(AbsListView.java:766)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.widget.GridView.&lt;init&gt;(GridView.java:110)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     at android.widget.GridView.&lt;init&gt;(GridView.java:106)
  09-15 18:30:43.169: E/AndroidRuntime(1081):     ... 27 more
  </code></pre>
  
  <p>Any help you be great. Thanks!</p>
  
  <p>This is the layout containing the GridView (R.layout.grid_view_person_record):</p>
  
  <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"
      android:paddingBottom="15dp"
      android:paddingLeft="15dp"
      android:paddingRight="15dp"
      android:paddingTop="15dp"
      tools:context=".PersonRecord" &gt;
  
       &lt;GridView
           android:id="@android:id/list"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           android:layout_margin="4dp"
           android:columnWidth="80dp"
           android:gravity="center"
           android:numColumns="auto_fit"
           android:paddingLeft="@android:id/list"
           android:stretchMode="columnWidth" &gt;
  
      &lt;/GridView&gt;
  
       &lt;TextView
           android:id="@android:id/empty"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_alignLeft="@android:id/list"
           android:layout_alignTop="@android:id/list" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>