android - NullPointerException on Activity Testing Tutorial -


I am currently trying to perform an Activity Testing Tutorial, and there is a problem. It seems that whenever I try to make some calls inside UIThread, I have a Java. Lung Nullpointer exposure is available.

  Public Zero TestSpanerUI () {mActivity.runOnUiThread (New Runnabal) {Public Zero Run} {MSpinner.requestFocus ();}}); }  

This gives me:

Incomplete: java.lang.NullPointerException

And nothing else. I have tried it on two different samples, with the same result. I tried with an attempt / catch class around the mSpinner.requestFocus () call, and it seems that the mSpinner is zero inside the thread. I found this properly set up () function in the same sample, and a quick assertNotNull (mSpinner) shows me that mSpinner is not actually zero after the set up () function. What could be the cause of this?

Edit; Okay, something else has been tested. It seems that the application for resetting between each trial is being tested. It is essential that I have to re-establish all the variables between each test. Is this normal?

OK, it seems that I'm working now. At a certain point at least I'm still not able to run anything inside runOnUiThread (), but I found out that using @UtThreadTest annotations, I found satisfactory results. I no longer get the NullPointer exception, and the set up () method also runs correctly. I do not know what was the reason, but hey, at least this is working :)


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -