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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:24:07+00:00 2026-06-14T03:24:07+00:00

I am new to android. I have a requirement now. I need to add

  • 0

I am new to android. I have a requirement now. I need to add around 10 images in the res/drawable folder and on running the app i should display this images on a listView.and on selecting any of the image i should display this image in the new activity should be able to zoom in and zoom out. Please help me out to figure out this with the sample code.

Thanks in advance.

  • 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-14T03:24:08+00:00Added an answer on June 14, 2026 at 3:24 am

    this example for create Gallery, select one and set to selectedImageView.
    so after that you can do everything with selectedImageView.

      public class MyActivity extends Activity{
    
        private int selectedImagePosition = 0;
        private ImageView selectedImageView;
        private List<Drawable> drawables;
        private Gallery gallery;    
    
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
          selectedImageView = (ImageView) view.findViewById(R.id.selected_imageview);
          getDrawablesList();
    
          gallery = (Gallery) view.findViewById(R.id.Gallery);
          gallery.setAdapter(new ImageAdapter(getActivity().getApplicationContext()));
    
          gallery.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, final int position, long id) {
    
            setSelectedImage(selectedImagePosition);
    
        }
        });
    
    
    
         private void getDrawablesList() {
                drawables = new ArrayList<Drawable>();
                drawables.add(getResources().getDrawable(R.drawable.res1));
                drawables.add(getResources().getDrawable(R.drawable.res2));
                drawables.add(getResources().getDrawable(R.drawable.res3));
                drawables.add(getResources().getDrawable(R.drawable.res4));
            }
    
        private void setSelectedImage(int selectedImagePosition) {
    
                BitmapDrawable bd = (BitmapDrawable) drawables.get(selectedImagePosition);
                Bitmap b = Bitmap.createScaledBitmap(bd.getBitmap(), (int) (bd.getIntrinsicHeight() * 0.9), (int) (bd.getIntrinsicWidth() * 0.7), false);
                selectedImageView.setImageBitmap(b);
                selectedImageView.setScaleType(ScaleType.FIT_XY);
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new in Android. I have develop an app. And now want to
I have a requirement where I need to develop an Android application for Nexus
I am playing around with Android MapView and have come across a requirement, where
I have a requirement to add the alt attribute to each of the images
I am relatively new to Android development. My requirement is such that I have
hi to all i am new to android i have to send my different
I am a bit new with android but I have some java experience. So
i am creating a new android application.i am using the table layout. I have
Ok, im fairly new to android but i have managed to teach myself the
I'm new to android apps development and I have a basic sqlite question. What

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.