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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:26:01+00:00 2026-05-20T09:26:01+00:00

hey, i’m new to android and i have a slight problem. i’m trying to

  • 0

hey,
i’m new to android and i have a slight problem. i’m trying to put together a listview with images are loaded through a URL. this works so far, but the images wont show up. logcat says this:

02-23 19:20:48.447: INFO/System.out(833): resolveUri failed on bad bitmap uri: android.graphics.drawable.BitmapDrawable@405359b0

its obviously not finding my image, but i have no idea why. using R.drawable.icon works though. can anyone help me out? heres my source:

public class Main extends Activity {
        private ListView lv_main;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        lv_main = (ListView) findViewById(R.id.listviewmain);

        ArrayList<HashMap<String, String>> listItem = new ArrayList<HashMap<String, String>>();

        HashMap<String,String> map;

        map = new HashMap<String, String>();
        map.put("title", "a title goes here");
        map.put("details", "details blaa");
        map.put("cover", String.valueOf(Main.this.LoadImageFromWebOperations("http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"));
        //THIS WORKS FINE: map.put("cover", String.valueOf(R.drawable.icon));
        listItem.add(map);

        map = new HashMap<String, String>();
        map.put("title", "2nd title");
        map.put("details", "more details");
        map.put("cover", String.valueOf(Main.this.LoadImageFromWebOperations("http://www.google.com/images/srpr/nav_logo37.png"));
        //THIS WORKS FINE: map.put("cover", String.valueOf(R.drawable.icon));
        listItem.add(map);

        SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.listviewitem, new String[] {"cover", "title", "details"}, new int[] {R.id.cover, R.id.title, R.id.details});

        lv_main.setAdapter(mSchedule);
     }

    public 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;
        }
    }
}

thanks in advance.
rob

  • 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-05-20T09:26:01+00:00Added an answer on May 20, 2026 at 9:26 am

    I have resolved this issue.
    I am using the code to solve the issue.

    Here ‘Path’ is a local file System path that can be got using: Environment.getExternalStorageDirectory().getAbsolutePath()

    public static String loadImageFromWebOperations(String url, String path) {
        try {
            InputStream is = (InputStream) new URL(url).getContent();
    
            System.out.println(path);
            File f = new File(path);
    
            f.createNewFile();
            FileOutputStream fos = new FileOutputStream(f);
            try {
    
                byte[] b = new byte[100];
                int l = 0;
                while ((l = is.read(b)) != -1)
                    fos.write(b, 0, l);
    
            } catch (Exception e) {
    
            }
    
            return f.getAbsolutePath();
        } catch (Exception e) {
            System.out.println("Exc=" + e);
            return null;
    
        }
    }
    

    Hope this helps :).

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

Sidebar

Related Questions

Hey I am very new to Web Programming. I have been learning PHP from
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey peoples, I've been studying Java for a couple of weeks, and have decided
Hey right now I'm using jQuery and I have some global variables to hold
Hey having some trouble trying to maintain transparency on a png when i create
Hey there, I'm at the moment trying to make a product management application. The
Hey guys, I have a client who wants their front site to have a
Hey guys, I have a little button functionality that is not erring, but also
Hey guys. I'm trying to configure TFS2010 on a home server. I want to
Hey everyone! I am having trouble with understanding modules -- I have two files,

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.