Fragment Refresh

后端 未结 1 1213
醉话见心
醉话见心 2020-12-22 05:01

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

相关标签:
1条回答
  • 2020-12-22 05:08
    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);
                }
            });
    
    0 讨论(0)
提交回复
热议问题