Yeah... the examples on developer.android.com also do it this way.  The
better and more supported way though is to use views.

On Thu, Feb 24, 2011 at 1:09 PM, Danny S. <[email protected]>wrote:

> Hi Justin,
>
> first: thanks. I used activities cause I "learned" it reading the docs
> on code.google.com. Do you mean I should use ListViews for example and
> put them into the tabs instead using Activities? Youre right, then I
> would have one activity for my data (TabActivity) and I can render my
> views from there based on the data I fetch only once at startup.
>
> It sounds really good :D
>
> Thanks, maybe there will be comments from more users ;-)
>
> -Danny S.
>
> On 24 Feb., 20:45, Justin Anderson <[email protected]> wrote:
> > Sounds to me like the cleanest approach would be to rewrite it so that
> each
> > tab is a View instead of an Activity.  Combine all the logic of
> activities
> > A, B, and C into the TabActivity.  That way you have a central location
> for
> > your data and you don't have to read the database to update the other
> tab.
> >
> > TabActivity really is designed for putting views in the tabs and only has
> > minimal support for putting activities in there...  According to Dianne
> (one
> > of the Android Framework engineers) support for activities is there from
> the
> > Android 1.1 days but then they shifted gears and changed the way things
> were
> > set up and it never got finished.
> >
> > On Thu, Feb 24, 2011 at 12:39 PM, Danny S. <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I have a TabActivity with Activity "B" on Tab1 and Activity "C" on
> > > Tab2. Both extends Activity "A" where I do the most. They use the same
> > > kind of data. Activity B is using data thats state is "active" and
> > > Activity C is using data in state "finished". So far so good...
> >
> > > Now I have the possibility to finish an active item or to reactivate a
> > > finished item. When I do this, the item will removed from the
> > > ListAdapter of the view and I refresh my view. The items where updated
> > > in the database too. Everything works fine, but now my concern:
> >
> > > When the state of data changes it should be displayed in the other
> > > activity (B <-> C). Is it possible to refresh my data without fetching
> > > all of them from database? Now I check with each TabChange if the
> > > cursor size of my select differs from my list adapters size. If yes,
> > > then clear the list adapter and rebuild it completely. I think this is
> > > not a "clean" efficient way.
> >
> > > My aim was to fetch all data at onCreate() and then work with the list
> > > adapter so be efficient and save battery where I can.
> >
> > > I've got an idea in this moment: there is an activity manager. maybe I
> > > can fetch activity C from activity B and call a method with the given
> > > row ids to make a database refresh for activity C with every state
> > > change!?
> >
> > > Hope someone can help and discuss ;-)!
> >
> > > -Danny S.
> >
> > > --
> > > 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
>
> --
> 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
>

-- 
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