Skip to content

Instantly share code, notes, and snippets.

@budioktaviyan
Created December 27, 2016 17:19
Show Gist options
  • Save budioktaviyan/6c0f7d34ad4150b8ea0aeb6334d8253d to your computer and use it in GitHub Desktop.
Save budioktaviyan/6c0f7d34ad4150b8ea0aeb6334d8253d to your computer and use it in GitHub Desktop.
Home Fragment Class (Cont'd)
public class HomeFragment extends Fragment {
@Override
public void onActivityCreated(@Nullable final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final RecyclerView recyclerView = (RecyclerView) getActivity().findViewById(R.id.rv_home);
final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
final HomeAdapter homeAdapter = new HomeAdapter(items);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.smoothScrollToPosition(recyclerView.getBottom());
recyclerView.setAdapter(homeAdapter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment