Ayden
06/07/2018, 8:34 AMfindViewById() and findViewById<>()?gildor
06/07/2018, 8:35 AMfindViewById<>() is not valid syntax in Kotlin, are you asking about Java?gildor
06/07/2018, 8:36 AMAyden
06/07/2018, 8:36 AMgildor
06/07/2018, 8:36 AMfindViewById<>() in KotlinAyden
06/07/2018, 8:36 AMrecyclerView = findViewById(R.id.vibe_recycler_view).apply{} Not validgildor
06/07/2018, 8:37 AMfindViewById<SomeView>()gildor
06/07/2018, 8:37 AMAyden
06/07/2018, 8:37 AMrecyclerView = findViewById<RecyclerView>(R.id.vibe_recycler_view).apply{} Valid.gildor
06/07/2018, 8:37 AMgildor
06/07/2018, 8:37 AMgildor
06/07/2018, 8:38 AMAyden
06/07/2018, 8:38 AM<RecyclerView> just to tell the compiler i am confirm this findViewByID is RecyclerView?gildor
06/07/2018, 8:38 AMgildor
06/07/2018, 8:38 AMgildor
06/07/2018, 8:39 AMval recyclerView: RecyclerView = findViewById()
is validgildor
06/07/2018, 8:39 AMval recyclerView = findViewById<RecyclerView>()
also validAyden
06/07/2018, 8:39 AMprivate lateinit var recyclerView: RecyclerView
recyclerView = findViewById<RecyclerView>(R.id.vibe_recycler_view)gildor
06/07/2018, 8:39 AMval recyclerView = findViewById()
because compiler doesn’t know type that you want, function findViewById is parameterizedAyden
06/07/2018, 8:40 AMAyden
06/07/2018, 8:41 AMrecyclerView is RecyclerViewAyden
06/07/2018, 8:41 AMfindViewById is RecyclerView?gildor
06/07/2018, 8:42 AMgildor
06/07/2018, 8:42 AMgildor
06/07/2018, 8:42 AMgildor
06/07/2018, 8:42 AMgildor
06/07/2018, 8:42 AMAyden
06/07/2018, 8:51 AMgildor
06/07/2018, 8:51 AMgildor
06/07/2018, 8:52 AMgildor
06/07/2018, 8:53 AMAyden
06/07/2018, 8:54 AM.apply?gildor
06/07/2018, 8:54 AMAyden
06/07/2018, 8:55 AMrequireViewById or findViewById right?gildor
06/07/2018, 8:56 AMgildor
06/07/2018, 8:56 AMAyden
06/07/2018, 8:56 AMgildor
06/07/2018, 8:57 AMfun <T : View> Activity.requireViewById(id: Int) = findViewById<T>(id) ?: error("View with id $id not found")Ayden
06/07/2018, 8:58 AMAyden
06/07/2018, 8:58 AMAyden
06/07/2018, 8:58 AM