Search Results

Search found 1 results on 1 pages for 'realn0whereman'.

Page 1/1 | 1 

  • Android thread handler NullPointerException

    - by Realn0whereman
    So this null pointer is confusing me. I believe it is a scope issue. My main activity looks like this: public class App extends Activity { ProgressDialog progressDialog; ProgressThread progressThread; Then inside of the oncreate I do this: ProgressDialog progressDialog = new ProgressDialog(this); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage("Fetching Images..."); ProgressThread progressThread = new ProgressThread(handler,mImageIds,mImages); progressThread.start(); progressDialog.show(); THEN inside progressThread which is a separate class I do mHandler.sendMessage(mHandler.obtainMessage()); Now up until this point i believe it behaves as it should. I have my handler hanging out in class scope right underneath my oncreate final Handler handler = new Handler() { public void handleMessage(Message msg){ progressDialog.hide(); progressThread.interrupt(); } }; The program thinks that progressDialog and progressThread are declared, but are null. Why would they be null if I instantiate in my oncreate.

    Read the article

1