I want when i press a specific Button an Image (like a map) to be displayed. What is more light-weight for my application? Getting this from a url or having it on the drawable folder and just display it?
If I choose the second one, and want to implement a “back” button I will have to put the whole thing in an extra class or not?
My application needs connection to the Internet, regardless of this.
I’d go with a drawable, purely for this reason, what happens when the user starts the app with no wifi/3g/etc. or an extremely slow connection. You say your application needs a connection, but that doesn’t necessarily mean the user will have it enabled when they start the app.
Its also a lot easier with a drawable, simply put it into the drawable folder then specify it as source for your ImageView (if you are using a clickable imageview)
or as the background if you are using a Button in the xml file.
though you may want to use a selector to change between 2 images (pressed and unpressed state)
and instead specify the selector xml file as the background/source
ie
android:background="@drawable/back_button_selector"Downloading an image needs to be done in a background thread (such as an AsycnTask) or the UI will not respond while the image is downloading.
But if you decide to download the image for some reason (ie. you want to have the image change without putting out an update and just changing it on the server) here’s an AsyncTask to download an image (you can use it as an inner class)