What i want to do is , allow user to swipe and refresh the list, it does not matter if the data is there or not. But when data is there in the listview only the listview should be visible, and when data is not there , Empty textview should be visible. In both the cases user must be able to refresh list by swipe.
I tried some solution given here in this discussion but none of them sounds working, the idea of taking two SwipeToRefresh works fine as given Here, but it shows empty container even while fetching data from server.
I tried it with my own logic wrapping Listview and Textview inside a Relative/FrameLayout but SwipeToRefresh accepts one view only as per its behavior
Here is an xml snippet i have tried
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/activity_main_swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.945" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/event_list_eventlist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@color/event_background"
android:dividerHeight="1dp" >
</ListView>
<TextView
android:id="@+id/event_txt_nothing_found"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@android:color/darker_gray"
android:visibility="gone" />
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
Please help