Hi wanted to know the difference between the following two ways of using the interface 1. navbar.setOnItemSelectedListener { object : ChipNavigationBar.OnItemSelectedListener{ override fun onItemSelected(id: Int) { var fragment: Fragment? = null when (id) { R.id.home -> fragment = HomeFragment() R.id.graphical_stats -> fragment = GraphicalStats() R.id.sources -> fragment = SourcesFragment() } if (fragment != null) { supportFragmentManager.beginTransaction().replace(R.id.container_frame, fragment) .commit() } else { Log.e(TAG, "Error Creating Fragment") } } 2. navbar.setOnItemSelectedListener { id -> var fragment: Fragment? = null when (id) { R.id.home -> fragment = HomeFragment() R.id.graphical_stats -> fragment = GraphicalStats() R.id.sources -> fragment = SourcesFragment() } if (fragment != null) { supportFragmentManager.beginTransaction().replace(R.id.container_frame, fragment) .commit() } else { Log.e(TAG, "Error Creating Fragment") } } Please let me know the difference between the two the second one works But the first one doesn't
Suppose in all 4 section we want to do different things..means suppose in Home we want add a list view which contains only text information and in Like section we want to another list view which contains only images and in search section we want to add search option and in profile section we want to show only user profile..so how it will be possible with this..I am talking about Instagram and Facebook design..hope you will understand
6:22 bro i cant use that variable "tvPosition" can you help me??
Hi wanted to know the difference between the following two ways of using the interface
1. navbar.setOnItemSelectedListener { object : ChipNavigationBar.OnItemSelectedListener{
override fun onItemSelected(id: Int) {
var fragment: Fragment? = null
when (id) {
R.id.home -> fragment = HomeFragment()
R.id.graphical_stats -> fragment = GraphicalStats()
R.id.sources -> fragment = SourcesFragment()
}
if (fragment != null) {
supportFragmentManager.beginTransaction().replace(R.id.container_frame, fragment)
.commit()
} else {
Log.e(TAG, "Error Creating Fragment")
}
}
2. navbar.setOnItemSelectedListener { id ->
var fragment: Fragment? = null
when (id) {
R.id.home -> fragment = HomeFragment()
R.id.graphical_stats -> fragment = GraphicalStats()
R.id.sources -> fragment = SourcesFragment()
}
if (fragment != null) {
supportFragmentManager.beginTransaction().replace(R.id.container_frame, fragment)
.commit()
} else {
Log.e(TAG, "Error Creating Fragment")
}
}
Please let me know the difference between the two
the second one works
But the first one doesn't
It's fine. Thank you. Tell me, how can I implement, when I click on one of these buttons, to open a new activity?
Suppose in all 4 section we want to do different things..means suppose in Home we want add a list view which contains only text information and in Like section we want to another list view which contains only images and in search section we want to add search option and in profile section we want to show only user profile..so how it will be possible with this..I am talking about Instagram and Facebook design..hope you will understand
Ok thank you for your suggestion
@@abdulazizahwan plsss how can i navigate through the fragment with different display in java
If you look for java code watch this th-cam.com/video/OBzLEjsrfq4/w-d-xo.html
tanya bang , kalau navbarnya ndak pake fragment apakah bisa? , jadi nanti ganti2 activity tiap klik tombol navigasinya
Please be patient with us and make more videos i respect u
Thanks
hi bro, big tutorials to appreciate, i need implement tabbar whit activitys no fragment , is posible whit this toutorial in klotin ? tnks
You should do an example that uses multiple fragments. This does not show me how to switch between multiple screens.
There is no findNavController in chipNavigationBar
Boss ,, yang ini untuk apa? fungsi nya apa?jelas kan boleh tak?
Untuk mengatur kondisi pas kita ngeklik menu
Bahasa indonesia dong bosssku
we want java
Soon as possible
@@abdulazizahwan can you also make video on scroll able bottom app bar
For example -scrollable bottom app bar present in photo editing app like Adobe Photoshop mobile
Ok thanks
This java th-cam.com/video/OBzLEjsrfq4/w-d-xo.html
java code plz
Next video bro
@@abdulazizahwan did you made a video on java for the same but using different fragments
@@mohitmahajan1947 haven't yet
This java code th-cam.com/video/OBzLEjsrfq4/w-d-xo.html