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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:53:46+00:00 2026-06-05T17:53:46+00:00

the tutorial here http://www.edumobile.org/android/android-beginner-tutorials/creating-image-gallery/ teaches how to put images from resources in gallery here’s

  • 0

the tutorial here http://www.edumobile.org/android/android-beginner-tutorials/creating-image-gallery/ teaches how to put images from resources in gallery

here’s the part where it set the images to be displayed:

private Integer[] mImageIds = {
            R.drawable.icon,
            R.drawable.icon,
            R.drawable.icon
    };

public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(mContext);
        i.setImageResource(mImageIds[position]);
        i.setLayoutParams(new Gallery.LayoutParams(150, 100));
        i.setScaleType(ImageView.ScaleType.FIT_XY);
        i.setBackgroundResource(mGalleryItemBackground);
        return i;
    }

but i want to display a couple of images from the web instead. so here’s what I did:

String gallery1 = "http://www.myimages.com/1.png";
URL ulrn = new URL(gallery1);
HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
InputStream is = con.getInputStream();
Bitmap bmp = BitmapFactory.decodeStream(is);

    if (null != bmp){
      bmp = getResizedBitmap(bmp,150,120);  //resize the thumb
      i.setImageBitmap(bmp);
      i.setLayoutParams(new Gallery.LayoutParams(150, 100));
      i.setScaleType(ImageView.ScaleType.FIT_XY);
      i.setBackgroundResource(mGalleryItemBackground);

but using the method I did above I could only display 1 picture inside the gallery, where as i need to also display another pictures inside the gallery, for example from http://www.myimages.com/2.png and http://www.myimages.com/3.png. How can I do this?

  • 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-05T17:53:48+00:00Added an answer on June 5, 2026 at 5:53 pm

    Here you call Image link one time but Gallery baseAdapter class getView Call for Every item. you need to call for every time.

    Create a Array For Url. Like

    String[] URl={http://www.myimages.com/2.png , http://www.myimages.com/,png,http://www.myimages.com/2.png};

    and Call this Method From Your getView Method

       public Drawable ImageOperations(String imageurl) {
            try {
                InputStream is = (InputStream) new URL(imageurl).getContent();
                Drawable drawable = Drawable.createFromStream(is, "src");
                return drawable;
            } catch (MalformedURLException e) {
                return null;
            } catch (IOException e) {
                return null;
            }
    
        }
    

    and Then Edit some Line of your getView Method.

    i.setImageDrawable(ImageOperations(URl[position]));
    

    Thanks

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

Sidebar

Related Questions

So I am a beginner and I was reading a tutorial here: http://www.freewebmasterhelp.com/tutorials/phpmysql/4 on
I've been going through a bit of the lemur indexing tutorial here: http://www.lemurproject.org/tutorials/begin_indexing-1.php I've
I went through the tutorial here: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application , and I can get a graph
I'm trying to do the tutorial here: http://www.asp.net/entity-framework/tutorials/handling-concurrency-with-the-entity-framework-in-an-asp-net-mvc-application In the ActionResult Edit, I have
I followed a tutorial located here: http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/ and so far everything worked fine with
i have set up Wiki:Family using the tutorial #2 specified here http://www.mediawiki.org/wiki/Wiki_family Specifically, i
i have a grails application and i'm following the tutorial here: http://www.grails.org/Services i have
Am following the tutorial here on creating a simple todo list app: http://www.mydroid.apnafundaz.com/2010/07/todolist-application-in-android-step-by-step-guide-with-screen-shots/ Have
Going through the tutorial here: http://www.asp.net/mvc/tutorials/iteration-4-make-the-application-loosely-coupled-cs I've noticed that they are passing the EF
I am following a tutorial here http://www.blackweb20.com/2010/01/11/creating-your-own-google-chrome-extension/ I can open fine a tab with

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.