I am using a ListFragment to display tweets from Twitter by HashTags.
The code for displaying tweets from Twitter is simply
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query(mHashtags)
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
.setTimeline(searchTimeline)
.build();
setListAdapter(adapter);
I need to allow my users to change the hashtags dynamically; that is, they may make a search for #thingOne
and then after viewing the results make a search for #TwoThings
. How do I accomplish this? When I try to call setListAdapter
with a new adapter, I can an exception (which really does not make sense to me, as I am not really changing anything except a new instance of the same adapter)
java.lang.ClassCastException: android.support.v4.view.ViewPager$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
So does the Twitter Fabric api provides a way for changing the SearchTimeline for an adapter? If not, is there a way for replacing the adapter for a ListFragment?