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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:13:37+00:00 2026-06-04T04:13:37+00:00

I am coding image gridview in android and I would like to question you

  • 0

I am coding image gridview in android and I would like to question you how to show Large image when user click on small image in gridview and how can I make gridview able to scrolling by swipe because my gallery has a lot of images.

Here is my code:

public class myalbum extends Activity {

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.myalbum);

    GridView gridView = (GridView) findViewById(R.id.gridview);
    gridView.setAdapter(new ImageAdapter(this));

    gridView.setOnItemClickListener(new GridView.OnItemClickListener() 
    {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) 
        {                
            //Here I want to see Large Image???? How can i do?????
            Toast.makeText(myalbum.this, "" + position, Toast.LENGTH_SHORT).show();
        }
    });        
}

public class ImageAdapter extends BaseAdapter {
    private Context mContext;

    public ImageAdapter(Context c) {
        mContext = c;
    }

    public int getCount() {
        return mThumbIds.length;
    }

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

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

    HashMap<Integer, Matrix> mImageTransforms = new HashMap<Integer,Matrix>();
    Matrix mIdentityMatrix = new Matrix();
    //---returns an ImageView view---
 // create a new ImageView for each item referenced by the Adapter
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(88, 88));
            imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
            imageView.setPadding(2, 2, 2, 2);
        } else {
            imageView = (ImageView) convertView;
        }

        Matrix m = mImageTransforms.get(position);
        if ( null == m ) {
            m = mIdentityMatrix;
        }
        imageView.setImageMatrix(m);
        imageView.setImageResource(mThumbIds[position]);
        return imageView;
    }

    void setImageRotation(int position, int degrees) {
        Matrix m = mImageTransforms.remove(position);        
        if ( degrees != 0 ) {
            if ( null == m ) m = new Matrix();
            m.setRotate(degrees);
            mImageTransforms.put(position, m);
        }
        notifyDataSetChanged();
    }

    private Integer[] mThumbIds = {
            R.drawable.p1, R.drawable.p2,
            R.drawable.p1, R.drawable.p2,
            R.drawable.p1, R.drawable.p2,
            R.drawable.p1, R.drawable.p2,
            R.drawable.p3, R.drawable.p4
    };
  }
}

Best Regards,
Virak

  • 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-04T04:13:38+00:00Added an answer on June 4, 2026 at 4:13 am

    Actually i can’t get where you actually want to display image.
    By the way you need to add your grid view in FrameLayout so, after that you can create on layout programmatically(with background color transparent) add imageView to it in same way and add that layout to your frameLayout and on image click you can set its visibility to visible so it displays image on top of your grid view as you simply view images on FB
    and provide close button which sets the visibility of that layout to Gone.

    Hope this helps you. let me know if any problem..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with Android currently, coding in Eclipse. I'm trying to set an image
So I have a random question when coding the image processing function that involves
Below is my coding where it would load the image when this Activity is
I am coding for iOs. I would like to interact with a webservices platform
I know it is better coding practice to avoid inline javascript like: <img id=the_image
I have this peice of coding which simply swaps an image when a link
I was coding a snake game, and i got an apple image to use
i m really very fed up coding translate animation. actually my image is moving
New to iOS coding, so this is probably more of a syntax question than
I am coding a website with multiple pages of thumbnail image galleries. I want

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.