0
  • The server is sending a list of urls of images when the application loads.

  • After parsing the url,The Application is Supposed to fetch that images from the server and display those images as MARQUEE on it's header as a BANNER.

  • On Clicking on that banner...a link is to be open(Say for example link of any WebSite).

    Can Anybody tell me how to fetch this image from the url and Save it temporarily and Display them as Banner.

    Regards.

Haresh Chaudhary
  • 4,390
  • 1
  • 34
  • 57

3 Answers3

2
  • Use AsyncTask for downloading images from server (Store them in external storage).
  • After complete the download display those images in Gallery view as a Banner. (Put Gallery view in banner).
  • As Android Gallery doesn't support Marquee, use animation for Gallery view (Like Marquee).
user370305
  • 108,599
  • 23
  • 164
  • 151
2

I used this code for loding img form url

ImageView v_thumburl = (ImageView) rowView
                .findViewById(R.id.v_thumb_url);
        thumburl = temp.getString(temp.getColumnIndex("thumburl"));
        Drawable drawable = LoadImageFromWebOperations(thumburl);
        v_thumburl.setImageDrawable(drawable);

private Drawable LoadImageFromWebOperations(String url) {
    try {
        InputStream is = (InputStream) new URL(url).getContent();
        Drawable d = Drawable.createFromStream(is, "src name");
        return d;
    } catch (Exception e) {
        System.out.println("Exc=" + e);
        return null;
    }
}

try this i hope it may help u

Jagan
  • 692
  • 1
  • 12
  • 38
1

For Loading Image from The Server you can use LasyList which will fetch the image from server and store it into SD Card.

SlideShow will be better than Marquee, so if you want SlideShow see this

And If you want marquee then what you can so is have and HorizontalListView

Add a public Method in HorizontalListView Class as shown below

public void getScrollWidth() {
        return mMaxX;
    }

public void getCurrentScrollX() {
      return mNextX;
}

and For Marquee have a Thread and a Handler in your class like this.

new Thread(new Runnable() {

                @Override
                public void run() {
                    try {
                        handler.post(new Runnable() {
                            @Override
                            public void run() {

                                if((horizontalListView.getCurrentScrollX() + 50) < horizontalListView.getScrollWidth())
                                {
                                    horizontalListView.scrollTo(horizontalListView.getCurrentScrollX() + 50);
                                }
                                else
                                {
                                    horizontalListView.scrollTo(0);
                                }
                            }
                        });

                        Thread.sleep(1000);

                    } catch (Exception e) {

                    }

                }
            }).start();
Vivek Khandelwal
  • 7,829
  • 3
  • 25
  • 40