Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8666741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:48:19+00:00 2026-06-12T17:48:19+00:00

am using the following code to trigger on clicking an image in a gallery

  • 0

am using the following code to trigger on clicking an image in a gallery

                holder.imgPostImagesGallery.setOnItemClickListener(new AdapterView.OnItemClickListener() {

                    //handle clicks
                    @Override
                    public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                        System.out.println("Iamge adapter clicked");
                        /*Show ImageViewerfragment*/
                        Intent intent = new Intent(getActivity(), ImagePagerActivity.class);
                        //Generate Image Array first
                        String[] urls=new String[1];
                        urls[0]=feedsTableList.get(position).post_content.images.get(position).toString();
                        intent.putExtra(Extra.IMAGES, urls);
                        intent.putExtra(Extra.IMAGE_POSITION, 0);
                        startActivity(intent);  
                    }                       
                });

Image Adapter Code

public class ImageAdapter extends BaseAdapter {
    public ArrayList<String> images;
    private Context mContext;       
    public ImageAdapter(Context c,ArrayList<String> arrayImages) {
        mContext = c;
        images=arrayImages;
    }

    public int getCount() {
        return images.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }
    //http://www.edumobile.org/android/android-development/image-gallery-example-in-android/
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView = new ImageView(mContext);
        imageView.setLayoutParams(new Gallery.LayoutParams(320, 320));          
        imageView.setBackgroundResource(R.drawable.black_button);
        imageLoader.displayImage(images.get(position), imageView, options);
        //Add tap listeners
        imageView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

            }
        });
        return imageView;

    }



}

The gallery works fine, but nothing happens on clicking/tapping an image.

And also, i seem to be having an issue with gallery scrolling, it just does’nt seem right. Scrolling lags and at times does’nt scroll at all. I am using this along with SlidingMenu library.

Update:

As mukesh pointed, i had 2 click events which i missed. But removing them also did’nt help; but adding my own clicklistener helped

//click listener for gallery
private class galleryPhotoClickListener implements OnItemClickListener{    
    private Context context;

    public galleryPhotoClickListener(Context context){
        this.context = context;
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position,
            long id) {
        Intent intent = new Intent(getActivity(), ImagePagerActivity.class);
        //Generate Image Array first
        String[] urls=(String[]) feedsTableList.get(position).post_content.images.toArray();
        urls[0]=feedsTableList.get(position).post_content.images.get(position).toString();
        intent.putExtra(Extra.IMAGES, urls);
        intent.putExtra(Extra.IMAGE_POSITION, 0);
        startActivity(intent);  

    }

}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:48:21+00:00Added an answer on June 12, 2026 at 5:48 pm

    use only one 1 or 2

    1.  holder.imgPostImagesGallery.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    
                        //handle clicks
                        @Override
                        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                            System.out.println("Iamge adapter clicked");
                            /*Show ImageViewerfragment*/
                            Intent intent = new Intent(getActivity(), ImagePagerActivity.class);
                            //Generate Image Array first
                            String[] urls=new String[1];
                            urls[0]=feedsTableList.get(position).post_content.images.get(position).toString();
                            intent.putExtra(Extra.IMAGES, urls);
                            intent.putExtra(Extra.IMAGE_POSITION, 0);
                            startActivity(intent);  
                        }                       
                    });
    
    
    
        or
    
    
    
      2. imageView.setOnClickListener(new View.OnClickListener() {
    
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
    
                    }
                });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following PHP code for trigger creation but always get error, please
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
I am using following code to get source for image in wpf (image is
I'm using the following code to delay a trigger looping through a list of
I have the following code to count and trigger some functions using jQuery: jQuery('#input_guideName').keyup(function(e)
Want to trigger itemClicked event for a QTreeWidget Item using the following code. connect(aTreeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)),this,SLOT(CallM(QTreeWidgetItem*
I'm using the following code to trigger the playing of a swf file when
Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am using following code for showing a MessageBox with ok and cancel button.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.