findViewById, causing missing adapter error
See original GitHub issueWhen I execute DotsIndicator dotsIndicator = findViewById(R.id.dots_indicator_view_pager_insights);, getting an error message straight away
DotsIndicator: You have to set an adapter to the view pager before !
I do set the adapter right after the findViewById, shouldn’t the message appear later on, if no adapter has yet been set?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Not able to "findViewById" in Kotlin. Getting error "Type ...
Try something like: val recyclerView = findViewById<RecyclerView>(R.id.recycler_view). You can use Kotlin Android Extensions too for that.
Read more >I can't find why these errors are showing, anyone help?
there are errors in this bit of code, I have added the line numbers at the start. public class ViewHolder extends RecyclerView.ViewHolder {...
Read more >Evolution of Finding Views by ID in Android - Wajahat Karim
Obviously, the first one is the findViewById() method. Introduced in the API level 1, this requires an ID and returns a View object....
Read more >Getting NullPointerException on viewPager.setAdapter
One possible root cause for your problem would be that fact that the line: viewPager = (ViewPager) findViewById(R ...
Read more >Applying Data Binding for Views | CodePath Android Cliffnotes
Make sure that all your XML files with data binding have their errors fully resolved and the files are saved. Then be sure...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have similar issue. DotsIndicator call refreshDots() inside init(AttributeSet attrs) method when class initialize. So even viewPager = null at that moment.
Sorry but the code is clear:
You have an error somewhere in your code.