title: How to set text field about product name below of each image in grid view
body: <p>*<strong>*How to set text below of each image in Grid view</strong> </p>
  
  <blockquote>
    <blockquote>
      <p>i want to set text about product name below of each image when i click this  text so it     goes to full image a activity please help me.this is my code</p>
    </blockquote>
  </blockquote>
  
  <h2>This is my Android Grid Activity code</h2>
  
  <pre><code>package com.a.test;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.GridView;
  
  public class AndroidGridActivity extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.gridview);
  
  GridView gridView = (GridView) findViewById(R.id.grid_view);
  
  // Instance of ImageAdapter Class
  gridView.setAdapter(new ImageAdapter(this));
  /**
  * On Click event for Single Gridview Item
       * */
  gridView.setOnItemClickListener(new OnItemClickListener() {
  
  public void onItemClick(AdapterView&lt;?&gt; parent, View v,
  int position, long id) {
  
  // Sending image id to FullScreenActivity
  Intent i = new Intent(getApplicationContext(), FullImageActivity.class);
  // passing array index
  i.putExtra("id", position);
  startActivity(i);
  }
  });
  gridView.setOnItemClickListener(new OnItemClickListener() {
  
  public void onItemClick(AdapterView&lt;?&gt; parent, View v,
  int position, long id) {
  
  // Sending text id to FullScreenActivity
  Intent i = new Intent(getApplicationContext(),  FullImageActivity.class);
  // passing array index
  i.putExtra("id", position);
  startActivity(i);
  }
  });
  }
  }`
  </code></pre>
  
  <hr>
  
  <p>This is layout file of android grid view activity
      
      
      
      </p>
  
  <pre><code>&lt;TextView android:id="@+id/chooseText"
  android:layout_height="wrap_content"
  android:layout_width="85dp"
  android:text="TextView"
  android:layout_below="@+id/chooseImage"
  android:gravity="center"
  android:singleLine="true"
  android:ellipsize="marquee"
  android:marqueeRepeatLimit="marquee_forever"
  android:textColor="#3232FF"&gt;
  &lt;/TextView&gt;
  &lt;GridView 
  android:id="@+id/grid_view"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:numColumns="auto_fit"
  android:columnWidth="90dp"
  android:horizontalSpacing="10dp"
  android:verticalSpacing="10dp"
  android:gravity="center"
  android:stretchMode="columnWidth" 
  android:background="#0000FF"&gt;  
  
  &lt;/GridView&gt;
  &lt;/RelativeLayout&gt;  
  </code></pre>
  
  <hr>
  
  <p>This is my full image class<br>
      package com.example.androidhive;</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.widget.ImageView;
  
  public class FullImageActivity extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.full_image);
  
  // get intent data
  Intent i = getIntent();
  // Selected image id
  int position = i.getExtras().getInt("id");
  ImageAdapter imageAdapter = new ImageAdapter(this);
  
  ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
  imageView.setImageResource(imageAdapter.mThumbIds[position]);
  
  // get intent data
  Intent in = getIntent();
  
  // Selected text id
  int positiont = in.getExtras().getInt("id");
  ImageAdapter imageAdaptert = new ImageAdapter(this);
  
  TextView txtView = (TextView) findViewById(R.id.fulltext);
  txtView.setText(imageAdapter.mThumbTxt[position]);
  }
  
  }  
  </code></pre>
  
  <hr>
  
  <p>Its a full image layout code<br>
      
      </p>
  
  <pre><code>&lt;ImageView android:id="@+id/full_image_view"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_gravity="center"/&gt;
  &lt;TextView
  android:id="@+id/fulltext"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="center"
  android:textColor="#000000" /&gt;
  
  &lt;/LinearLayout&gt;  
  </code></pre>
  
  <hr>
  
  <p>its image adapter class<br>
      package com.example.androidhive;</p>
  
  <pre><code>import android.content.Context;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.GridView;
  import android.widget.ImageView;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  
  public class ImageAdapter extends BaseAdapter {
  private Context mContext;
  
  // Keep all Images in array
  public Integer[] mThumbIds = {
  R.drawable.pic_1, R.drawable.pic_2,
  R.drawable.pic_3, R.drawable.pic_4,
  R.drawable.pic_5, R.drawable.pic_6,
  R.drawable.pic_7, R.drawable.pic_8,
  R.drawable.pic_9, R.drawable.pic_10,
  R.drawable.pic_11, R.drawable.pic_12,
  R.drawable.pic_13, R.drawable.pic_14,
  
  };
  
  // Constructor
  public ImageAdapter(Context c){
  mContext = c;
  }
  
  
  public int getCount() {
  return mThumbIds.length;
  }
  
  
  public Object getItem(int position) {
  return null;
  }
  
  
  public long getItemId(int position) {
  return 0;
  }
  
  
  // create a new ImageView for each item referenced by the Adapter
  public View getView(int position, View convertView, ViewGroup parent) {
  ImageView imageView;
  
  if (convertView == null) {  // if it's not recycled, initialize some attributes
  imageView = new ImageView(mContext);
  imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
  imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  imageView.setPadding(8, 8, 8, 8);
  } else {
  imageView = (ImageView) convertView;
  }
  
  imageView.setImageResource(mThumbIds[position]);
  return imageView;
  }
  
  public String[] mThumbTxt = {
  "Müzeler", "Anıtlar", "İbadethaneler",   "Hepsi","iqra","rafia","sana","sobia","amna","aisha","asma","asna","urosa","asnam"
  };
  public View getView1(int position, View convertView, ViewGroup arg2) {
  View view = View.inflate(mContext, R.layout.gridview, null);
  RelativeLayout rl = (RelativeLayout) view.findViewById(R.id.relaGrid);
  
  ImageView image = (ImageView) rl.findViewById(R.id.chooseImage);
  TextView text = (TextView) rl.findViewById(R.id.chooseText);       
  image.setImageResource(mThumbIds[position]);
  text.setText(mThumbTxt[position]);
  return rl;
  }
  }
  </code></pre>