0

I'm trying to perform an HTTP get request, to download something from a web page (text or image).

What I need is to build a class that allows me to do that and use it in my app when i need it.

The idea is to have two methods:

  1. to download text from a url (return me a String)

  2. to download image (return me a Bitmap)

Example: I have a URL where there is an image, I use my method downloadBitmap() to get it and then i can do what I want. Like put it into an ImageView for display.

Sample code is appreciated.

aioobe
  • 413,195
  • 112
  • 811
  • 826
hyperloris
  • 346
  • 1
  • 7
  • 14
  • Try... http://stackoverflow.com/questions/11411209/bitmapfactory-decodestream-cannot-decode-png-type-from-ftp May be enough for you. – HATCHA Jul 11 '12 at 11:35

1 Answers1

0

Have a look at the Apache HTTP Client library. It is included in the Android platform.

The answers to the questions below should cover what you need to know.

Community
  • 1
  • 1
aioobe
  • 413,195
  • 112
  • 811
  • 826
  • It's also good idea to put it in [AsyncTask](http://developer.android.com/reference/android/os/AsyncTask.html), so app won't freeze while downloading – cyborg86pl Jul 11 '12 at 11:11
  • Thank you guys for your help, but i think that i will use this: http://code.google.com/p/android-query/ – hyperloris Jul 11 '12 at 15:21