0
I’m not understanding the error, I want to do a simple thing with Progressbar but it does not give 'void android.widget.Progressbar.setVisibility(int)' on a null Object Reference.
I know this error is because Progressbar was not started, but I actually started it this way. Still it gives error.
ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar3);
progressBar.setVisibility(View.VISIBLE);
Just to be sure, this progressbar is being called where? Activity, Fragment, Dialog...? And if you can pass more of the code he’s in, it helps, too
– Murillo Comino
There is no mystery in the code no, is in an Activity, I just wanted to see how the progressBar works, but is giving this error at the time of the visualization this progressibar is the infinite progressibar the cyclic. Actually I will use in an Ansytask but also gives the same error. I did the test with progressbar in my Activity and gives the same error.
– Stênio Barroso de Moraes
I really wanted to use the progressibar as follows inside Ansytask in onPreExecute() show the progressibar and onPostExecute make it invisible. Remembering that it is only the cyclic.
– Stênio Barroso de Moraes
Check this id
R.id.progressBar3
with the layout, because the error is implying that the variableprogressBar
does not reference any object.– Augusto Vasques
Good morning, @Stêniobarrosodemoraes! As simple as your problem may seem, only with these two lines of code you will not be able to solve it, because the answers will be just speculation. Edit your question and include the missing code
– Ivan Silva
I am working with Mapview in Activity the issue of the error is that I can only start the progressibar after starting Mapview because it happens I do not know, so I put the progressiBar.setVisibility(View.VISIBLE) code; in the last line and it works.
– Stênio Barroso de Moraes
Now when I try to use inside an Ansytask gives error even passing the parameters to the Ansytask constructor.
– Stênio Barroso de Moraes