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

  • SEARCH
  • Home
  • 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 7742355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:15:19+00:00 2026-06-01T09:15:19+00:00

I am using image view and gallery in my xml file. i am getting

  • 0

I am using image view and gallery in my xml file. i am getting gallery image for webservice(remote images).

when i select image from gallery i want to display in android image view.

here my code,

 ImageAdapter.java

public class ImageAdapter extends BaseAdapter
{
    private Context context = null;
     DataService Ds;
    LayoutInflater mInflater;

     private String[] myRemoteImages;



    public ImageAdapter(Context context)
        {
            this.context = context;
            //myRemoteImages = imgArray;
            mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        }

    @Override
    public int getCount()
        {
            return this.myRemoteImages.length;
        }

    @Override
    public final Object getItem(int position)
        {
            return position;
        }

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

    @Override
    public View getView(int position, View view, ViewGroup group)
        {
            ImageView imageView = new ImageView(this.context);          

             try {

                 URL aURL = new URL(myRemoteImages[position]);
                 System.err.println(aURL);
                 URLConnection conn = aURL.openConnection();
                 conn.connect();
                 InputStream is = conn.getInputStream();
                 BufferedInputStream bis = new BufferedInputStream(is);
                 Bitmap bm = BitmapFactory.decodeStream(bis);
                 bis.close();
                 is.close();

                 imageView.setImageBitmap(bm);

            } catch (IOException e) {
                //imageView.setImageResource(R.drawable.nopic);
                 Log.e("DEBUGTAG", "Remote Image Exception", e);
            }
            imageView.setImageResource(position);
            imageView.setLayoutParams(new Gallery.LayoutParams(105, 70));
            return imageView;
        }

    public String[] getMyRemoteImages() {
        return myRemoteImages;
    }

    public void setMyRemoteImages(String[] myRemoteImages) {
        this.myRemoteImages = myRemoteImages;
    }
}


and DisplayImage.java

ImageView imgView;

gallery = (Gallery) this.findViewById(R.id.Gallery01);
        imageAdapter = new ImageAdapter(this);
        imageAdapter.setMyRemoteImages(ItemList.getImages());
        gallery.setAdapter(imageAdapter);

        gallery.setOnItemClickListener(new OnItemClickListener() 
        {
            public void onItemClick(AdapterView parent, 
            View v, int position, long id) 
            {          
                System.out.println("gallery position" +imageAdapter.getItemViewType(position));
                imgView.setImageResource(imageAdapter.getItemViewType(position));


            }
        });  
        }

any one can help me?

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-01T09:15:21+00:00Added an answer on June 1, 2026 at 9:15 am

    now its working. here is my code,

    DisplayImage.java:

    ImageView imgView;
    
    gallery.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView parent, View v, int position,
                        long id) {
                    System.out.println("Gallery position :"
                            + bikeItemList.getOriginalImages().get(position));
                    UrlImageViewHelper.setUrlDrawable(imgView, bikeItemList
                            .getOriginalImages().get(position));
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want display images in gallery view it want to focus to paticular image
I am using an Image view with these XML attributes <ImageView android:id=@+id/widget_list_bitmap android:layout_width=wrap_content android:layout_height=wrap_content
I am using a image view with a fixed height and width to display
i can't display the image on my aspx view.. i'm using mysql as database
i need to show images from sqlite database into gridview or gallery view. this
I am using full browser width height jquery blockUI to display selected image from
I have button of pick image from android gallery in one activity name DrawingActivity.
I am new to android.I have a image which is declared in xml file
I would like to load images into a gallery view from a url? I
I am developing an Image Gallery using scrollview. I want to know can I

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.