• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Get view within adapter from MainActivity

stubbzj12

Newbie
I already know how to set an on click listeners for my ListView in my MainActivity class. However, I need to get a view from my Adapter class.

Usually, I do something like view.FindViewById(R.id.whatever) inside my adapter class to get a specific view. But how do I get it from my MainActivity class? I apologise if I don't make any sense.

Thanks!
 
Although, to answer your original question, findViewById() can be called directly from your code in MainActivity, as this is a method provided by the Activity class, from which your MainActivity extends.
 
Back
Top Bottom