title: Android - Add url for each item in gridview to download the file from defined url
body: <p>Hello to all great developers and helpers. I need some help. 
  I have gridview with defined icons. (They stored in application, i dont need to download them from internet).</p>
  
  <p>1st Question - How to add textview (i.e Name of the Icon) to the existing gridview adapter?</p>
  
  <p>2nd Question (Most important, first priority to solve) - How can i add specified urls for each item and clicking on it user will download specified file? (E.g - My gridview shows Skins, clicking on it user will be able to download the skin which he choose.) 
  I tried many ways, cannot find the solution. 
  Something like that:</p>
  
  <pre><code>    public void prepareList()
  {
      listHttp = new ArrayList();
      listHttp.add("http://yoursite/file1.apk");
      listHttp.add("http://yoursite/file2.apk");
      listHttp.add("http://yoursite/file3.apk");
  </code></pre>
  
  <p>SkinsActivity.class</p>
  
  <pre><code>import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.GridView;
  import java.util.ArrayList;
  
  public class SkinsActivity extends Activity {
  com.htc.widget.HtcAlertDialog.Builder builder;
  
  
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.grid_layout);
  
      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() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View v,
                  int position, long id) {
  
  
              HtcAlertDialog.Builder alertDialog = new HtcAlertDialog.Builder(SkinsActivity.this);
  
            //   Setting Dialog Title
             alertDialog.setTitle("Confirm Installation");
  
           //   Setting Dialog Message
              alertDialog.setMessage("Do you want to install this skin?");
  
          //    Setting Icon to Dialog
              alertDialog.setIcon(R.drawable.ic_about);
  
            //   Setting Positive "Yes" Button
              alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog,int which) {
  
              //    Write your code here to invoke YES event
                  Toast.makeText(getApplicationContext(), "You clicked on YES", Toast.LENGTH_SHORT).show();
                 }
              });
  
              // Setting Negative "NO" Button
            alertDialog.setNegativeButton("NO", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                  // Write your code here to invoke NO event
                Toast.makeText(getApplicationContext(), "You clicked on NO", Toast.LENGTH_SHORT).show();
              dialog.cancel();
               }
           });
  
              // Showing Alert Message
             alertDialog.show();
  
  
          }
      });
  }
  </code></pre>
  
  <p>ImageAdapter.class (Gridviewadapter) </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;
  
  public class ImageAdapter extends BaseAdapter {
  private Context mContext;
  
  // Keep all Images in array
  public Integer[] mThumbIds = {
          R.drawable.sense5, R.drawable.sense5red,
          R.drawable.concrete, R.drawable.graphite,
          R.drawable.sense5_full,
  
  };
  
  
  
  
  // Constructor
  public ImageAdapter(Context c){
      mContext = c;
  }
  
  @Override
  public int getCount() {
      return mThumbIds.length;
  }
  
  @Override
  public Object getItem(int position) {
      return mThumbIds[position];
  }
  
  @Override
  public long getItemId(int position) {
      return 0;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      ImageView imageView = new ImageView(mContext);
      imageView.setImageResource(mThumbIds[position]);
      imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      imageView.setLayoutParams(new GridView.LayoutParams(250, 180));
      return imageView;
  }
  
  }
  </code></pre>