Skip to content Skip to sidebar Skip to footer

Fragment Refresh

I am trying to refresh a fragment class without detaching from fragment. I have inserted some data by sqlite but unless I restart my application that change doesn't show up. Please

Solution 1:

I haved solved the issue by adding swipe refresh layout. Here is my code :

this is refresh layout :

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swiperefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>



this is refresh listener : 

swipeContainer = (SwipeRefreshLayout) rootView.findViewById(R.id.swiperefresh);
        swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                //do all refreshing tasks  
                swipeContainer.setRefreshing(false);
            }
        });

Post a Comment for "Fragment Refresh"