title: Error:Using GridView with Fragment
body: <p>I have a fragment MobilesFragment and I want to show a gridview inside it, which will contain two textviews and an imageview, but on my first run, th is an exception which is occuring,</p>
  
  <pre><code>E/AndroidRuntime﹕ FATAL EXCEPTION: main
  android.content.res.Resources$NotFoundException: String resource ID #0x64
          at android.content.res.Resources.getText(Resources.java:201)
          at android.widget.TextView.setText(TextView.java:2863)
          at com.devs.fookart.GridViewAdapter.getView(GridViewAdapter.java:54)
          at android.widget.AbsListView.obtainView(AbsListView.java:1430)
          at android.widget.GridView.onMeasure(GridView.java:935)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
          at android.view.View.measure(View.java:8313)
          at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
          at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
          at android.view.View.measure(View.java:8313)
          at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:868)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
          at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
          at android.view.View.measure(View.java:8313)
          at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
          at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:130)
          at android.app.ActivityThread.main(ActivityThread.java:3683)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:507)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
          at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>My gridview layout file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;GridView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/dataGrid"
      android:numColumns="2"
      android:layout_gravity="center_horizontal" &gt;
  &lt;/GridView&gt;
  </code></pre>
  
  <p>Here is my Fragment class:</p>
  
  <pre><code>package com.ui.fragments;
  
  import android.app.Activity;
  import android.content.Context;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.drawable.Drawable;
  import android.support.v4.app.Fragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.GridView;
  
  import com.data.dataclass.GridViewData;
  import com.devs.fookart.GridViewAdapter;
  import com.devs.fookart.R;
  
  import java.util.ArrayList;
  
  
  public class MobilesFragment extends Fragment
  {   private GridViewAdapter adapter;
  private GridView mList;
  private Context context;
  private ArrayList&lt;GridViewData&gt; gridItems;
  private String titles[]={"Headphones","Camera","Home","Mobile"};
  private int prices[]={100,122,212,122};
  private ArrayList&lt;Bitmap&gt; bmp;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
  {   View rootView=inflater.inflate(R.layout.fragment_mobiles,container,false);
      context=container.getContext();
      bmp=new ArrayList&lt;Bitmap&gt;();
      bmp.add(BitmapFactory.decodeResource(context.getResources(),R.mipmap.ic_headphones));
      bmp.add(BitmapFactory.decodeResource(context.getResources(),R.mipmap.ic_camera));
      bmp.add(BitmapFactory.decodeResource(context.getResources(),R.mipmap.ic_home));
      bmp.add(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_mobile));
      gridItems=new ArrayList&lt;GridViewData&gt;();
      mList=(GridView)rootView.findViewById(R.id.dataGrid);
      gridItems.add(new GridViewData(1,titles[0],bmp.get(2),prices[0]));
      gridItems.add(new GridViewData(2,titles[1],bmp.get(2),prices[1]));
      gridItems.add(new GridViewData(3,titles[2],bmp.get(3),prices[2]));
      gridItems.add(new GridViewData(4,titles[3],bmp.get(2),prices[3]));
  
      adapter=new GridViewAdapter(context,gridItems);
      mList.setAdapter(adapter);
      return rootView;
  }
  }
  </code></pre>
  
  <p>GridItem Layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:weightSum="1"&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="Title"
      android:id="@+id/title"
      android:layout_weight="0.02" /&gt;
  
  &lt;ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/product"
      android:layout_weight="0.36"
      android:src="@mipmap/ic_launcher" /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceMedium"
      android:text="Price"
      android:id="@+id/price"
      android:layout_weight="0.02" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>GridViewData class:</p>
  
  <pre><code>package com.data.dataclass;
  
  import android.graphics.Bitmap;
  
  public class GridViewData
  {   private String name;
  private int price,id;
  private Bitmap image;
  
  public GridViewData(int id,String name,Bitmap image,int price)
  {   this.name=name;
      this.image=image;
      this.price=price;
      this.id=id;
  }
  
  public int getId()
  {   return id;
  }
  
  public void setId(int id)
  {   this.id = id;
  }
  
  public String getName()
  {   return name;
  }
  
  public void setName(String name)
  {   this.name=name;
  }
  
  public int getPrice()
  {   return price;
  }
  
  public void setPrice(int price)
  {   this.price=price;
  }
  
  public Bitmap getImage()
  {   return image;
  }
  
  public void setImage(Bitmap image)
  {   this.image=image;
  }
  }
  </code></pre>
  
  <p>At last GridView Adapter class:</p>
  
  <pre><code>package com.devs.fookart;
  
  import android.app.Activity;
  import android.content.Context;
  import android.widget.TextView;
  import android.widget.ImageView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  
  import com.data.dataclass.GridViewData;
  
  import java.util.ArrayList;
  
  public class GridViewAdapter extends BaseAdapter
  {   private ArrayList&lt;GridViewData&gt; GridItem;
  private Context context;
  
  public GridViewAdapter(Context context,ArrayList&lt;GridViewData&gt; GridItem)
  {   this.context=context;
      this.GridItem=GridItem;
  }
  
  @Override
  public int getCount()
  {   return GridItem.size();
  }
  
  @Override
  public Object getItem(int position)
  {   return GridItem.get(position);
  }
  
  @Override
  public long getItemId(int position)
  {   return position;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent)
  {   if(convertView==null)
      {   LayoutInflater mInflater=(LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
          convertView=mInflater.inflate(R.layout.product_grid,null);;
      }
      ImageView img=(ImageView)convertView.findViewById(R.id.product);
      TextView title=(TextView)convertView.findViewById(R.id.title);
      TextView price=(TextView)convertView.findViewById(R.id.price);
      img.setImageBitmap(GridItem.get(position).getImage());
      title.setText(GridItem.get(position).getName());
      price.setText(GridItem.get(position).getPrice());
      return convertView;
  }
  }
  </code></pre>
  
  <p>It will be a huge help, Thanks a ton in advance....</p>