brianwphamSF / Android-TwitterClient_Redux

0 stars 0 forks source link

In the fragments for Home timeline and Mentions timeline, I noticed a bug in the addAll(adapter) and therefore made a check however... #1

Open brianwphamSF opened 10 years ago

brianwphamSF commented 10 years ago

In HomeTimelineFragment line 41 and MentionsFragment line 28, these are supposed to check whether or not the list has been populated already or not, otherwise switching between tabs will duplicate the list. @nesquena, it works after a few tries on the first boot of the app when the list is empty, but it's quite annoying sometimes to see an empty list. Is there a better way to do this?

nesquena commented 10 years ago

Why not just clear the adapter with getAdapter().clear() around here: https://github.com/TKiet415/Android-TwitterClient_Redux/blob/master/src/com/codepath/apps/mytwitterapp/fragments/HomeTimelineFragment.java#L42 so that when you load the initial data set it clears the old items? Also check out the first tip in helpful hints and follow the guide for a better pattern for managing tabs (using a listener). Did I misunderstand the question?

Also, you should consider if there's a better way to access the listview here https://github.com/TKiet415/Android-TwitterClient_Redux/blob/master/src/com/codepath/apps/mytwitterapp/fragments/TweetsListFragment.java#L49. Consider that the listview is from within the fragment itself, why access the list through the activity. In fact, we should probably never reach into an activity from in a fragment to find views if you remember the lecture. I know what the video does (which gets it working) but see if you can think of a cleaner way (hint it has to do with onCreateView).