Created
September 24, 2021 09:06
-
-
Save Ahmad-Hamwi/f59f2ace61a02d076d632b02fd2fd55c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
initViews() | |
initTabLayout() | |
initRecycler() | |
} | |
private fun initViews() { | |
tabLayout = findViewById(R.id.tabLayout) | |
recyclerView = findViewById(R.id.recyclerView) | |
} | |
private fun initTabLayout() { | |
for (category in categories) { | |
tabLayout.addTab(tabLayout.newTab().setText(category.name)) | |
} | |
} | |
private fun initRecycler() { | |
recyclerView.adapter = CategoriesAdapter(this, categories) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment