0

Can anyone help me how to put images in a hashmap?

I tried something like this :

HashMap<String, Object> map = new HashMap<String, Object>();
                    String img_1 = "<img src='http://graph.facebook.com/" + friends.get(i).getId()
                            + "/picture?type=small' />";

                    map.put("item", Html.fromHtml(img_1));
                    map.put("friend", friends.get(i).getName());
                    System.out.println("Valoare HashMap este:" + map);
                    mylist.add(map);

but I see only the text, without image.

Please help....

AJJ
  • 7,365
  • 7
  • 31
  • 34
Gabrielle
  • 137
  • 1
  • 13
  • are you using webview to display image ? – Ketan Parmar Jul 19 '11 at 09:51
  • I have at http://graph.facebook.com/" + friends.get(i).getId() + "/picture?type=small the image that I want to display...I am trying to display the image and the name of my friends in my android app...I don't know what should I do for the image :( – Gabrielle Jul 19 '11 at 09:57
  • http://stackoverflow.com/questions/1991431/android-html-fromhtml-to-load-image-from-web – chedine Jul 19 '11 at 10:49

1 Answers1

0

Here: http://developer.android.com/reference/android/text/Html.html in description of public static Spanned fromHtml (String source)
it says:
"Returns displayable styled text from the provided HTML string. Any tags in the HTML will display as a generic replacement image which your program can then go through and replace with real images."
So, you are getting the what you are supposed to get from this method, if you need to get whole images have a look at: Android HTML.fromHTML() with images?

Community
  • 1
  • 1
Zia Ul Rehman Mughal
  • 2,119
  • 24
  • 44