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
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
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
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
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
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
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
7 matches
Mail list logo