How to create onClickListener for Gallery?
<p>How to register a click for a image in a gallery?</p>

<p>For Example. When a image is clicked a url opens up</p>

<p>EDIT: Errors i get when using the method below.</p>

<pre><code>08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.widget.AdapterView.performItemClick(AdapterView.java:282)
 08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.widget.Gallery.onSingleTapUp(Gallery.java:867)
 08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.GestureDetector.onTouchEvent(GestureDetector.java:557)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.widget.Gallery.onTouchEvent(Gallery.java:842)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.View.dispatchTouchEvent(View.java:4600)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1488)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1256)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1494)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1269)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1494)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1269)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1494)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1269)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1494)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1269)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1700)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1270)
08-05 13:40:38.875: ERROR/AndroidRuntime(690):     at android.app.Activity.dispatchTouchEvent(Activity.java:2277)
</code></pre>

<p>EDIT: Here i am retreiving the images from a text document url.</p>

<pre><code> public void getImages() throws IOException{


    DefaultHttpClient httpclient = new DefaultHttpClient();

    HttpGet httppost = new HttpGet("https://example.com/webImages.txt");
    HttpResponse response;

    response = httpclient.execute(httppost);


    HttpEntity ht = response.getEntity();

    BufferedHttpEntity buf = new BufferedHttpEntity(ht);

    InputStream is = buf.getContent();


    BufferedReader r = new BufferedReader(new InputStreamReader(is), 8);

    StringBuilder total = new StringBuilder();
    String line;
    while ((line = r.readLine()) != null) {
    total.append(line + "\n");


     Log.v("getImage1", "Retreived image");
              imageUrl = total.toString();

          }

     }
</code></pre>

<p>Since the URL is retrieved from the TEXT doc how will i change the setTag every time the URL is changed inside the text document for the images to be retreived?</p>
