i can get it to work from the mainactivity.kt but ...
# android
m
i can get it to work from the mainactivity.kt but not from CustomAdapter.kt , startActivity() isnt there
g
you can find method startActivity() in any Context instance. So there are two ways: 1. pass a context instance to adapter 2. delegate activity start to outer code, for example pass lambda or other listener to adapter and adapter will call this listener on click Second one requires more code, but make your adapter more flexible and decoupled.
🎖️ 1