[android-developers] Re: Applications that relies on external datas.

2013-04-18 Thread Piren
that's not the point of the fragment... i meant that the fragment should handle both the logic (and data download) and the UI. then you can just plop it in any activity you want and you're set. Regarding the Application onCreate - Yeah, it will be before anything else, but you dont know how

[android-developers] Re: Applications that relies on external datas.

2013-04-17 Thread Piren
Don't let the UI handle the data (activity), add a Business Logic layer to do that. I.E - create a class that is responsible for managing this data. if data is present, load from DB, if not, download for the net. Then let whichever activity that needs the data, interact with that class

[android-developers] Re: Applications that relies on external datas.

2013-04-17 Thread RichardC
Use a Service to retrieve and manage the data, Bind the service from Activity A and B. If the data is available use it, if it not download it (in the service). On Wednesday, April 17, 2013 3:57:28 PM UTC+1, mbaroukh wrote: I have a problem that appear on every new developpement. I never

[android-developers] Re: Applications that relies on external datas.

2013-04-17 Thread mbaroukh
Don't let the UI handle the data (activity), add a Business Logic layer to do that. I totally agree with that and data is loaded from a separate layer actually called by activity A. But I was looking how to avoid to have each activities call the initialisation of this layer. It seems obvious

[android-developers] Re: Applications that relies on external datas.

2013-04-17 Thread mbaroukh
Service or not every activity must implement a logic to wait for the download to complete isn't it ? So it must have a logic for it own process and a logic for the download. That make those activities more complicated than they have to be. Is it and Android design problem that have no solution

[android-developers] Re: Applications that relies on external datas.

2013-04-17 Thread Piren
I'll reply here for both messages: Yeah it is android design, i dont like it myself but they did supply some help - Fragments... they are the middle ground between pure UI and BL... You can have a fragment that handles the whole thing and use it in both activities (i personally think that the

[android-developers] Re: Applications that relies on external datas.

2013-04-17 Thread mbaroukh
If using fragment, I suppose I could make only one activity that will handle logic (and data download) that will do what AndroidApplication should and many fragment that won't have to manage more than their own state. But that did not seems clean to me. Doing it in OnCreate of the application