From what I can gather it appears that this might be because my ListView is not being displayed, I\'ve verified that getCount is returning a value not zero, but I can\'t see wha
I think I found the problem. The issue appears because of the ShackGestureListener
that you setup at the start of the onActivityCreated
method in the FragmentTopicView
:
final ShackGestureListener listener = Helper.setGestureEnabledContentView(R.layout.topics, getActivity());
if (listener != null) {
listener.addListener(this);
}
In the setGestureEnabledContentView()
method you check to see if the user enabled the gestures in the preferences or if the android version is bigger then 3. Either way, true
or false
you set the content view for the FragmentActivityTopic
again(with the layout of the FragmentTopicView
). Setting the content view again will, unfortunately, cover the current layout which holds the ListView
with data(ListView
that populates with no problems). When you run those AsyncTasks
to get the data, at the end you set the data on the correct ListView
(returned by getListView
) because the getListView
will hold a reference to the old correct ListView
which was set in the onCreateView
method, but you don't see anything because in the setGestureEnabledContentView
you cover this ListView
.
This behavior is easy to see if you simple comment out(or remove) the lines that set the content view for the activity in the Helper
and HelperAPI4
classes. Another way to see that your ListView
is covered is, for example to set the adapter for the ListView
(tva) using getListView
and using the getActivity().findViewById(android.R.id.list)
(I've done this on selecting one of your menus items, so I can control when I replace the adapter):
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId())
{
case R.id.topic_menu_newpost: // Launch post form
//this doesn't work as the getListView will return a reference to the old ListView
ListView lv = getListView();
lv.setAdapter(tva);
// this will work as you get a reference to the new ListView on top
ListView lv = (ListView) getActivity().findViewById(android.R.id.list);
lv.setAdapter(tva);
I don't know what to recommend as a solution as I don't quite understand what you're doing, but I doubt that it requires to set the content view for the activity again(and you should work from this).