title: gridview crash in real android device but working fine in android emulator
body: <p>I have an fragment for showing images in gridview, it's open at click of naviagation drawer item , it is working fine with android emualtor but it crash on real android device </p>
  
  <p>here is my frament_info_photos</p>
  
  <pre><code>&lt;LinearLayout 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:orientation="vertical"
      tools:context="com.abcd.InfoPhotos"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textColor="@color/black"
          android:layout_marginTop="20dp"
          android:layout_marginLeft="20dp"
          android:textSize="25sp"
          android:textAppearance="@style/TextAppearance.AppCompat.Medium"
          android:textStyle="normal"
          android:text="photos" /&gt;
      &lt;View
          android:layout_width="75dp"
          android:layout_height="5dp"
          android:layout_marginLeft="20dp"
          android:background="@color/Shade_browm"/&gt;
      &lt;GridView
          android:layout_marginTop="12dp"
          android:layout_marginLeft="15dp"
          android:layout_marginRight="15dp"
          android:id="@+id/photos_fragment"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:columnWidth="100dp"
          android:numColumns="auto_fit"
          android:verticalSpacing="10dp"
          android:horizontalSpacing="10dp"
          android:stretchMode="columnWidth"
          android:gravity="center"&gt;&lt;/GridView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>InfoPhotos.java</p>
  
  <pre><code>public class InfoPhotos extends Fragment {
      GridView gridView;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View view=inflater.inflate(R.layout.fragment_info_photos, container, false);
          gridView = (GridView) view.findViewById(R.id.photos_fragment);
          gridView.setAdapter(new ImageAdapter(getActivity()));
          gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                      int position, long id) {
  
  
              }
          });
          return view;
      }
  
  }
  </code></pre>
  
  <p>and my ImageAdapter.java</p>
  
  <pre><code>public class ImageAdapter extends BaseAdapter {
      private int images[] ={R.drawable.img1, R.drawable.img2, R.drawable.img3, R.drawable.img4, R.drawable.img5,
              R.drawable.img6, R.drawable.img7, R.drawable.img8, R.drawable.img9};
      Context context;
  
      public ImageAdapter(Context context) {
          this.context = context;
      }
  
      @Override
      public int getCount() {
          return images.length;
      }
  
      @Override
      public Object getItem(int i) {
          return null;
      }
  
      @Override
      public long getItemId(int i) {
          return 0;
      }
  
      @Override
      public View getView(int arg0, View arg1, ViewGroup arg2) {
          ImageView imageView;
          if(arg1 == null)
          {
              imageView = new ImageView(context);
              imageView.setLayoutParams(new GridView.LayoutParams(90, 90));
              imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
              imageView.setPadding(0, 0, 0, 0);
          }
          else {
              imageView = (ImageView) arg1;
          }
          imageView.setImageResource(images[arg0]);
          return imageView;
      }
  }
  </code></pre>
  
  <p>i don't know what's wrong with code</p>