title: Android MultiThreading with afterTextChanged
body: <p>i started to work with MultiThreading as 
  and i wanted to go validate user input so i looked at the question <a href="https://stackoverflow.com/questions/22929113/android-multithreading-with-textwatcher">here</a></p>
  
  <p>but still from some reason my apps crashed and i can't pinpoint to the problem</p>
  
  <p>RegisterActivity.Java</p>
  
  <pre><code>@Override
      public void afterTextChanged(final Editable editable) {
          email = etEmail.getText().toString();
          new AsyncTask&lt;Void, Void, Void&gt;() {
              protected Void doInBackground(Void... params) {
                  if( !isValidEmail(email))
                      LoginActivity.alertDialog(getApplicationContext(),"test","test");
                      return null;
              }
  
          }.execute();
      }
  </code></pre>
  
  <p>LoginActivity.java (and yes i know that this function shouldn't be here)</p>
  
  <pre><code>  public static   void alertDialog(Context context, CharSequence message, CharSequence type){
          AlertDialog.Builder builder = new AlertDialog.Builder(context);
          builder.setMessage(message)
                  .setNegativeButton(type, null)
                  .create()
                  .show();
      }
  </code></pre>
  
  <p>stacktrace</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main Process:com.example.ofir.bopofinal, PID: 3038
                                                                                    java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
                                                                                        at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:351)
                                                                                        at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:320)
                                                                                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:281)
                                                                                        at android.support.v7.app.AppCompatDialog.setContentView(AppCompatDialog.java:83)
                                                                                        at android.support.v7.app.AlertController.installContent(AlertController.java:214)
                                                                                        at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:258)
                                                                                        at android.app.Dialog.dispatchOnCreate(Dialog.java:394)
                                                                                        at android.app.Dialog.show(Dialog.java:295)
                                                                                        at com.example.ofir.bopofinal.LoginRegister.LoginActivity.alertDialog(LoginActivity.java:53)
                                                                                        at com.example.ofir.bopofinal.LoginRegister.RegisterActivity$3.onPostExecute(RegisterActivity.java:162)
                                                                                        at com.example.ofir.bopofinal.LoginRegister.RegisterActivity$3.onPostExecute(RegisterActivity.java:153)
                                                                                        at android.os.AsyncTask.finish(AsyncTask.java:651)
                                                                                        at android.os.AsyncTask.-wrap1(AsyncTask.java)
                                                                                        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                                                                                        at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                        at android.os.Looper.loop(Looper.java:148)
                                                                                        at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  </code></pre>