Skip to content
Advertisement

How to make textviews visible depending on progress of seekbar

I am trying to make 4 different textviews visible depending on the progress of my seekbar (one visible at a time). I set the textviews to invisible and the seekbar max to 100. It works fine for the values below 24, but the app crashes as soon as the seekbar exceeds 25.

I am an absolute beginner programmer and trying to teach myself, I thought about using a while loop instead, but I can´t make it work either.

I would greatly appreciate any help.

Code:

JavaScript

activity_main:

JavaScript

Advertisement

Answer

You have used findViewById to link a resource to your textView object. You need to do the same for textView2, textView3 and textView4. I presume you are getting a NullPointerException when you try to call a method on textView2.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement