publicclassTimelineActivityextendsActivity{privateSwipeRefreshLayoutswipeContainer;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);// Only ever call `setContentView` once right at the top
setContentView(R.layout.activity_main);// Lookup the swipe container view
swipeContainer=(SwipeRefreshLayout)findViewById(R.id.swipeContainer);// Setup refresh listener which triggers new data loading
swipeContainer.setOnRefreshListener(newSwipeRefreshLayout.OnRefreshListener(){@OverridepublicvoidonRefresh(){// Your code to refresh the list here.
// Make sure you call swipeContainer.setRefreshing(false)
// once the network request has completed successfully.
refreshData();}});// Configure the refreshing colors
swipeContainer.setColorSchemeResources(android.R.color.holo_blue_bright,android.R.color.holo_green_light,android.R.color.holo_orange_light,android.R.color.holo_red_light);}}