title: Android GridView show detailed item
body: <p>I got a source code about GridView.
  But, I confused why some code were error. 
  These are the code. I got error on OnClick Method in MainActivity. Is here anyone help me? Thanks</p>
  
  <pre><code>public void onItemClick(AdapterView &lt;? &gt; AdapterView, View View, int Int, long Long) {
  
      AdapterView = ((ImageItem) imageItems.get(Int)).getTitle();
                  toDetail(Int, AdapterView);
  
          }
      });
  </code></pre>
  
  <p>I want to each item that when it clicked shown the detailed image and text. I also get code like this but when I clicked "GingerBread" item, it goes to first item ("Astro")</p>
  
  <pre><code> public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
          ImageItem item = (ImageItem) parent.getItemAtPosition(position);
  
              //Create intent
          Intent intent = new Intent(getApplicationContext(), DetailActivity.class);
       //  intent.putExtra("android.intent.extra.TEXT", Integer.parseInt(getIntent().getStringExtra("android.intent.extra.TEXT")));
        intent.putExtra("title", item.getTitle());
              //Start details activity
          startActivity(intent);
           overridePendingTransition(R.anim.home_detail_entry, R.anim.home_detail_exit);
         }
      });
  </code></pre>
  
  <p><strong>MainActivity.java</strong> </p>
  
  <pre><code>package com.acer.gridview;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.ActivityNotFoundException;
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.GridView;
  import android.widget.ImageView;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  
  public class MainActivity extends Activity {
  
    public static String[] bitmapName = {
      "Astro", "Bender", "Cupcake", "Donut", "Eclair",
      "Froyo", "Gingerbread", "HoneyComb"
    };
    public static int[] bitmapId = {
      R.drawable.Astro, R.drawable.Bender, R.drawable.Cupcake, R.drawable.Eclair,
        R.drawable.Froyo, R.drawable.Gingerbread, R.drawable.HoneyComb
    };
  
    private GridViewAdapter gridAdapter;
    private GridView gridView;
    ArrayList &lt; ImageItem &gt; imageItems;
  
    private ArrayList &lt; ImageItem &gt; getData() {
      imageItems = new ArrayList();
      BitmapFactory.Options localOptions = new BitmapFactory.Options();
      localOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
      int i = 0;
      for (;;) {
        if (i &gt; 7) {
          return imageItems;
        }
        Bitmap localBitmap = BitmapFactory.decodeResource(getResources(), bitmapId[i], localOptions);
        imageItems.add(new ImageItem(localBitmap, bitmapName[i]));
        i += 1;
      }
    }
  
    @
    Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_image_grid);
  
      gridView = (GridView) findViewById(R.id.gridView);
      gridAdapter = new GridViewAdapter(this, R.layout.row_grid, getData());
      gridView.setAdapter(gridAdapter);
      gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
        public void onItemClick(AdapterView &lt;? &gt; AdapterView, View View, int Int, long Long) {
  
  ////////////This code shown error///////////////////
  
      AdapterView = ((ImageItem) imageItems.get(Int)).getTitle();
                  toDetail(Int, AdapterView);
  
  ////////////This code shown error///////////////////
  
        }
      });
    }
  
    public void toDetail(int Int, String String) {
      Intent localIntent = new Intent(this, DetailActivity.class);
      localIntent.putExtra("android.intent.extra.TEXT", Integer.toString(Int));
      localIntent.putExtra("title", String);
      startActivity(localIntent);
  
    }
  
    /**
     * A placeholder fragment containing a simple view.
     */
    private boolean ActionBar(final Intent aIntent) {
      try {
        startActivity(aIntent);
        return true;
      } catch (ActivityNotFoundException e) {
        return false;
      }
    }
  
    public void showDialog() {
      LayoutInflater inflater = getLayoutInflater();
      View localView = inflater.inflate(R.layout.help_dialog, null);
      ((ImageView) localView.findViewById(R.id.imageView1)).setImageResource(R.drawable.makhrojulhuruf);
      AlertDialog.Builder builder = new AlertDialog.Builder(this);
      builder.setView(localView);
      builder.show();
    }
  
  
  
    @
    Override
    public boolean onCreateOptionsMenu(Menu menu) {}
  
    @
    Override
    public boolean onOptionsItemSelected(MenuItem item) {
  
  
    }
  
  }
  </code></pre>
  
  <p><strong>GridViewAdapter.java</strong> </p>
  
  <pre><code>    package com.acer.gridview;
  
  import android.app.Activity;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import java.util.ArrayList;
  
  /**
   * Created by Acer on 08/02/2016.
   */
  public class GridViewAdapter extends ArrayAdapter&lt;ImageItem&gt; {
      private Context context;
      private int layoutResourceId;
      private ArrayList&lt;ImageItem&gt; data = new ArrayList();
  
      public GridViewAdapter(Context context, int layoutResourceId, ArrayList&lt;ImageItem&gt; data) {
          super(context, layoutResourceId, data);
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.data = data;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View row = convertView;
          ViewHolder holder = null;
  
          if (row == null) {
              LayoutInflater inflater = ((Activity) context).getLayoutInflater();
              row = inflater.inflate(layoutResourceId, parent, false);
              holder = new ViewHolder();
              holder.imageTitle = (TextView) row.findViewById(R.id.text);
              holder.image = (ImageView) row.findViewById(R.id.image);
              row.setTag(holder);
          } else {
              holder = (ViewHolder) row.getTag();
          }
  
          ImageItem item = (ImageItem) data.get(position);
          holder.imageTitle.setText(item.getTitle());
          holder.image.setImageBitmap(item.getImage());
          return row;
      }
  
      static class ViewHolder {
          TextView imageTitle;
          ImageView image;
  
      }
  }
  </code></pre>
  
  <p><strong>ImageItem.java</strong></p>
  
  <pre><code>package com.acer.gridview;
  
  import android.graphics.Bitmap;
  
  /**
   * Created by Acer on 08/02/2016.
   */
  public class ImageItem {
      private Bitmap image;
      private String title;
  
      public ImageItem(Bitmap Bitmap, String String)
      {
          setImage(Bitmap);
          setTitle(String);
      }
  
      public Bitmap getImage()
      {
          return this.image;
      }
  
      public String getTitle()
      {
          return this.title;
      }
  
      public void setImage(Bitmap Bitmap)
      {
          this.image = Bitmap;
      }
  
      public void setTitle(String String)
      {
          this.title = String;
      }
  }
  </code></pre>