On Wed, Jul 29, 2015 at 1:51 AM, gvi70000 <[email protected]> wrote:

> In my application i have a SlidingTabLayout, each tab containing a
> listview. when i go through the tabs several times the items are added in
> the listview each time. how can i prevent this behaviour?
>

Step through your code and debug the problem. Put a breakpoint where the
items are being added and review the stacktrace that leads to the multiple
calls. My guess would be the fact that you have an "items" array allocated
at Fragment construction time and add stuff to it in onCreateView, which
can get called multiple times within the fragment's lifecycle.

the second question
>
> On each tab i want to add a second fragment that will hold some controls,
> each fragment has to be linked with a list item from the list view, when i
> switch the tab the first list item has to be selected to display the
> corresponding fragment. How can i achieve this behavior?
>

You need to provide pictures or something. Your description is hard to
follow and thus impossible to answer.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to