diff --git a/app/src/main/kotlin/jackall/moncalc/adapter/MainFragmentPagerAdapter.kt b/app/src/main/kotlin/jackall/moncalc/adapter/MainFragmentPagerAdapter.kt index 7c6b34f..8893d34 100644 --- a/app/src/main/kotlin/jackall/moncalc/adapter/MainFragmentPagerAdapter.kt +++ b/app/src/main/kotlin/jackall/moncalc/adapter/MainFragmentPagerAdapter.kt @@ -15,11 +15,14 @@ class MainFragmentPagerAdapter(fragmentManager: FragmentManager, val context: Context) : FragmentPagerAdapter(fragmentManager) { val pageCount = 3 val titles = arrayOf(context.resources.getString(R.string.history), context.resources.getString(R.string.temple_analyze), context.resources.getString(R.string.fruit_analyze)) + val historyFragment by lazy { HistoryFragment() } + val templeAnalyzeFragment by lazy { TempleAnalyze() } + val fruitAnalyzeFragment by lazy { FruitAnalyze() } override fun getItem(position: Int): Fragment? { when (position) { - 0 -> return HistoryFragment() - 1 -> return TempleAnalyze() - 2 -> return FruitAnalyze() + 0 -> return historyFragment + 1 -> return templeAnalyzeFragment + 2 -> return fruitAnalyzeFragment } return null }