Skip to content

Instantly share code, notes, and snippets.

View mahmedMostafa's full-sized avatar
🏠
Working from home

Mohamed Mostafa mahmedMostafa

🏠
Working from home
  • Jumia
  • Egypt
View GitHub Profile
@Zhuinden
Zhuinden / MainActivity.kt
Last active December 30, 2022 09:40
Fragment multiple tabs without remove or replace
class MainActivity : AppCompatActivity() {
private lateinit var swipeFragment: SwipeFragment
private lateinit var favoritesFragment: FavoritesFragment
private lateinit var newsFragment: NewsFragment
private val fragments: Array<out Fragment> get() = arrayOf(swipeFragment, favoritesFragment, newsFragment)
private fun selectFragment(selectedFragment: Fragment) {
var transaction = supportFragmentManager.beginTransaction()
fragments.forEachIndexed { index, fragment ->