Skip to content

Instantly share code, notes, and snippets.

@hkakutalua
Created April 2, 2018 23:05
Show Gist options
  • Select an option

  • Save hkakutalua/864db7b34aa298588b61882f336ce391 to your computer and use it in GitHub Desktop.

Select an option

Save hkakutalua/864db7b34aa298588b61882f336ce391 to your computer and use it in GitHub Desktop.
Initialize loader
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.github.com")
.addConverterFactory(GsonConverterFactory.create())
.build();
mGithubService = retrofit.create(GithubService.class);
mAdapter = new UsersAdapter();
RecyclerView recyclerView = findViewById(R.id.recycler_view_users);
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(mAdapter);
getSupportLoaderManager().initLoader(LOADER_ID, null, this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment