Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package elixer.com.threadpool;
public class MainActivity extends AppCompatActivity {
private ArrayList<String> mTaskNames = new ArrayList<>();
private RecyclerView recyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager layoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initTaskNames();
initRecyclerView();
}
private void initTaskNames() {
for (int i = 1; i < 5; i++) {
mTaskNames.add("Task Number " + i);
}
}
private void initRecyclerView() {
recyclerView = findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new RecyclerViewAdapter(this, mTaskNames);
recyclerView.setAdapter(mAdapter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment