This sounds quite complicated.
Just download the image in an AsyncTask when the user clicks the button and 
you are done.

If the images are huge and you expect the user to leave the current 
activity while it is downloading, then you better use a background service 
to do the work and then notify when it is done. IntentService is a good 
place to start.

Uwe


On Wednesday, June 20, 2012 3:44:54 AM UTC+2, wBishop wrote:
>
> Howdy, 
>
> I was reading several articles on the web and posts on stackoverflow 
> (unfortunately I didn't find anything on android developers) about the 
> correct design pattern for an Android application, and I still haven't 
> come to a correct conclusion. It seems to be two different types of 
> opinions. 
>
> Please correct me if I'm wrong, but this is what I've understand: 
>
> For example, let's imagine that I have an application that has a 
> background service periodically firing to downloading images, when an 
> image is retrieved the user is notified. On the other hand the user 
> can click on a button and launch an asynctask to download a particular 
> image. 
>
> I believe this situation follows the MVC model: 
>
> - View, corresponds to the activity which in turns is linked with the 
> layout (perhaps modelview? and instead of MVC is MVVM?). When the user 
> clicks on the button it communicates with via async task with a 
> controller. 
>
> - Controller, corresponds to a class that extends application and 
> works as a manager, depending on the activity request it communicates 
> with the delegates the request to the corresponding class, in this 
> case the one which will retrieve that image. When the download is 
> finished it notifies the activity via broadcast. The service also 
> communicates with this manager. 
>
> - Model, corresponds to broadcasts that are made from the application 
> to the activity warning it that new data is available. 
>
>
> Is this correct? Sorry, for the long post, but this is driving me crazy. 
>
>
> Thanks in advance, 
> Walter 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to