How to set URL for gallery images being clicked?
<p>I am retreiving url strings from a text document on a server. </p>

<p>Once the images are retreived they are set to a gallery using a ImageAdapter.</p>

<pre><code> public class ImageAdapter extends BaseAdapter {

           /** The parent context */
       private Context myContext;public ImageAdapter() {
            // TODO Auto-generated constructor stub
            }


                /** URL-Strings to some remote images. */
        public String[] myRemoteImages = {imageUrl,imageUrl2,imageUrl3,imageUrl4};  

        private String[] mImageURLs = {
              "http://www.google.com",
              "http://www.google.com"};






                /** Simple Constructor saving the 'parent' context. */
         public ImageAdapter(Context c) { this.myContext = c; }





                /** Returns the amount of images we have defined. */
          public int getCount() { 
                return this.myRemoteImages.length;
                }




                /* Use the array-Positions as unique IDs */
           public Object getItem(int position) { 
                return position; 
                }


           public long getItemId(int position) { 
                    return position; 
                    }


                /** Returns a new ImageView to
                * be displayed, depending on
                * the position passed. */
            public View getView(int position, View convertView, ViewGroup parent) {
                ImageView i = new ImageView(this.myContext);

            //  i.setTag(mImageURLs[position]);


                try {


            URL aURL = new URL(myRemoteImages[position]);
            Log.v("ImageLoader", "Remote images set");


            URI imageUri = null;

            //Setting the Uri of aURL to imageUri.
            try {
            imageUri = aURL.toURI();

            } catch (URISyntaxException e1) {
            // TODO Auto-generated catch block
                e1.printStackTrace();
                        }



                //Testing to see if images are already in cache, if not then we load the images from the web and save them to the cache.
           if (new File(new File(myContext.getCacheDir(), "thumbnails"), "" + imageUri.hashCode()).exists())
                           {

        Log.v("Loader", "File exists in cache. Now pulling from the cache");

        String cachFile = myContext.getCacheDir() +"/thumbnails/"+imageUri.hashCode();
        FileInputStream fis;

        try {
        fis = new FileInputStream(cachFile);
        Bitmap bm = BitmapFactory.decodeStream(fis); 
        i.setImageBitmap(bm);
</code></pre>

<p>Now the problem is how can i set a URL for each image statically. Meaning that the url's will change when the images change. How could i possibly go about being able to control what urls are set to an each image?</p>

<p>For example. when a image is clicked, it opens up web browser to a URL set for that particular image.</p>

<p>A Week later the images change, How could i go about changing the url associated with it also?</p>

<p>EDIT: Error i get when using the arrayList of strings.</p>

<pre><code> 08-05 16:56:50.748: ERROR/AndroidRuntime(646): java.lang.ArrayIndexOutOfBoundsException: index=2 length=2
 08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at com.fttech.gameIT.MainMenu$ImageAdapter.getView(MainMenu.java:379)
08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at android.widget.Gallery.makeAndAddView(Gallery.java:748)
08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at android.widget.Gallery.fillToGalleryRight(Gallery.java:700)
08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at android.widget.Gallery.layout(Gallery.java:631)
08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at android.widget.Gallery.onLayout(Gallery.java:339)
08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at android.view.View.layout(View.java:9330)
08-05 16:56:50.748: ERROR/AndroidRuntime(646):     at android.view.ViewGroup.layout(ViewGroup.java:3795)
</code></pre>

<p>The error points me here...</p>

<pre><code>    public View getView(int position, View convertView, ViewGroup parent) {
                ImageView i = new ImageView(this.myContext);




                try {


            URL aURL = new URL(myRemoteImages[position]);
            Log.v("ImageLoader", "Remote images set");
            //It points me here  i.setTag(mImageURLs[position]);                    

            URI imageUri = null;
</code></pre>
