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 6801363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:05:28+00:00 2026-05-26T19:05:28+00:00

public class GalleryImageAdapter extends BaseAdapter{ private Activity activity; private ArrayList<String> listOfImages; public ImageLoader imageLoader;

  • 0
public class GalleryImageAdapter extends BaseAdapter{

    private Activity activity;
    private ArrayList<String> listOfImages;
    public ImageLoader imageLoader; 


    public GalleryImageAdapter(Activity a, ArrayList<String> listOfImages){
        activity = a;
        this.listOfImages = listOfImages;
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }

    @Override
    public int getCount() {
        return listOfImages.size();
    }

    @Override
    public Object getItem(int position) {
        return listOfImages.get(position);
    }

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

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        View v = convertView;


        if (v == null) {
            LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.gallery_layout, null);

        }



        final String url = listOfImages.get(position);


         ImageView galleryImage = (ImageView) v.findViewById(R.id.galleryImage);
         imageLoader.DisplayImage(url, activity, galleryImage);


         v.setLayoutParams(new Gallery.LayoutParams(LayoutParams.FILL_PARENT,200));
        return v;
    }


     public float getScale(boolean focused, int offset) {
         /* Formula: 1 / (2 ^ offset) */
           return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
       }

}

I have my gallery adapter here. I’m wondering if there is a method that I can utilize that allows me to detect when an image is changed, and retrieves the position number of the image, so I can send it to my activity.

  • 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-05-26T19:05:29+00:00Added an answer on May 26, 2026 at 7:05 pm

    Position is what you’re after. See AdapterView.OnItemSelectedListener.

        mGallery.setOnItemSelectedListener(new OnItemSelectedListener() {
    
            @Override
            public void onItemSelected(AdapterView<?> parent, View v,
                    int position, long id) {
                // position will display it's place in the adapter
            }
    
            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
                // Do nothing
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class XPBN extends Activity{ private Map _map; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState);
public class PackageTabActivity extends ListActivity{ HashMap<String,Object> hm ; ArrayList<HashMap<String,Object>> applistwithicon ; private static final
public class abc1 { private String s; public abc1(String s){this.s=s;} public static void main(String
public class BaseFoo { private string param; public BaseFoo(string param) { this.param = param;
public class PeopleCollection : IEnumerable { private Dictionary<string, Person> listPeople = new Dictionary<string, Person>();
public class WordDisplay extends Activity { private int level; private int group; private int
public class BobDatabase extends SQLiteOpenHelper{ private static final String DATABASE_NAME = bob.db; private static
public class Browser1Activity extends Activity { TextView url; WebView ourBrow; @Override protected void onCreate(Bundle
public class Persona { int Codigo; String Nombre; public Persona(int Codigo, String Nombre){ this.Codigo
public class hello { public static void main(String[] args) { Object[] newarray = new

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.