title: Application getting Unfortunately stopped when my edittext field make null
body: <p>I am confused what might be the reason behind this error.While making my edittext field null after entering a digit into it my application is getting crashed.can you find a solution for this situation ??</p>
  
  <p>here is my code </p>
  
  <p>java file </p>
  
  <pre><code>    public class CSLActivity extends AppCompatActivity {
  
      private Common mApp;
      private AutoCompleteTextView clgName, conCent, loc;
      private MultiAutoCompleteTextView skill;
      private String[] qulify = new String[]{"Select Highest Qualification", "PG", "UG", "DIPLOMA"};
      public String abc, abcd;
      public ScrollView scrollView;
      public ProgressBar progressBar;
      private String q;
      private Spinner level;
      private int ab = 1990;
      public EditText fullName, frm_yr, to_yr;
      private boolean ins = false;
      private boolean cIns = false;
      private Button next;
      private TextfieldValidator textfieldValidator;
      private AlphabetValidator alphabetValidator;
      private int i = 0, j = 0;
      private boolean exit = false;
      private String get;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_csl);
  
          scrollView = (ScrollView) findViewById(R.id.scroll_view);
          progressBar = (ProgressBar) findViewById(R.id.progress_bar);
          fullName = (EditText) findViewById(R.id.fullName);
          level = (Spinner) findViewById(R.id.level);
          clgName = (AutoCompleteTextView) findViewById(R.id.clg_name);
          conCent = (AutoCompleteTextView) findViewById(R.id.concent);
          frm_yr = (EditText) findViewById(R.id.frm_yr);
          to_yr = (EditText) findViewById(R.id.to_yr);
          skill = (MultiAutoCompleteTextView) findViewById(R.id.skill);
          loc = (AutoCompleteTextView) findViewById(R.id.location);
          textfieldValidator = new TextfieldValidator();
          alphabetValidator = new AlphabetValidator();
          next = (Button) findViewById(R.id.next);
  
          frm_yr.addTextChangedListener(new TextWatcher() {
  
              @Override
              public void onTextChanged(CharSequence s, int start, int before, int count) {
                  //abc = frm_yr.getText().toString();
  
              }
  
              @Override
              public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
              }
  
              @Override
              public void afterTextChanged(Editable s) {
                  //i = Integer.parseInt(frm_yr.getText().toString());
                  //i = Integer.parseInt(abc.toString());
                  i = Integer.parseInt(frm_yr.getText().toString());
  
              }
          });
  
  
          to_yr.addTextChangedListener(new TextWatcher() {
  
              @Override
              public void onTextChanged(CharSequence s, int start, int before, int count) {
  
              }
  
              @Override
              public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  
              }
  
              @Override
              public void afterTextChanged(Editable s) {
                  //j = Integer.parseInt(to_yr.getText().toString());
                  //j = Integer.parseInt(abcd.toString());
                  j = Integer.parseInt(to_yr.getText().toString());
              }
          });
  
  
          new GetCollege(CSLActivity.this, progressBar, scrollView, clgName).execute();
          new GetCourse(CSLActivity.this, conCent).execute();
          new GetSkillSet(CSLActivity.this, scrollView, progressBar, skill).execute();
          new GetLocation(CSLActivity.this, scrollView, loc, progressBar).execute();
  
  
          ArrayAdapter&lt;String&gt; adapter1 = new ArrayAdapter&lt;String&gt;(getApplicationContext(), R.layout.spinner_item, qulify);
          level.setAdapter(adapter1);
          level.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
              @Override
              public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  get = level.getSelectedItem().toString();
                  if (get.equalsIgnoreCase("PG")) {
                      q = "1";
                  } else if (get.equalsIgnoreCase("UG")) {
                      q = "2";
                  } else {
                      q = "3";
                  }
              }
  
              @Override
              public void onNothingSelected(AdapterView&lt;?&gt; parent) {
  
              }
          });
  
  
          clgName.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  TextView txt = (TextView) view.findViewById(R.id.ins_name);
                  clgName.setText(txt.getText().toString());
                  conCent.requestFocus();
                  ins = true;
  
              }
          });
  
          conCent.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  TextView txt = (TextView) view.findViewById(R.id.display);
                  conCent.setText(txt.getText().toString());
                  cIns = true;
                  frm_yr.requestFocus();
              }
          });
  
          loc.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  TextView txt1 = (TextView) view.findViewById(R.id.ins_name);
                  loc.setText(txt1.getText().toString());
                  InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                  imm.hideSoftInputFromInputMethod(view.getWindowToken(), 0);
              }
          });
  
          next.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  switch (v.getId()) {
                      case R.id.next:
  
                          if (fullName.getText().toString().length() == 0) {
                              fullName.setError("Field Mandatory");
                              fullName.requestFocus();
                          } else if (!alphabetValidator.validate(fullName.getText().toString())) {
                              fullName.setError("Enter a Valid Name");
                              fullName.requestFocus();
                          } else if (get.equalsIgnoreCase("Select Highest Qualification")) {
                              level.requestFocus();
                              Toast.makeText(getApplicationContext(), "select Qualification", Toast.LENGTH_SHORT).show();
                          } else if (clgName.getText().toString().length() == 0) {
                              clgName.setError("Field Mandatory");
                              clgName.requestFocus();
                          } else if (conCent.getText().toString().length() == 0) {
                              conCent.setError("Field Mandatory");
                              conCent.requestFocus();
                          } else if (frm_yr.getText().toString().length() == 0) {
                              frm_yr.setError("Field Mandatory");
                              frm_yr.requestFocus();
                          } else if (to_yr.getText().toString().length() == 0) {
                              to_yr.setError("Field Mandatory");
                              to_yr.requestFocus();
                          } else if (i &gt; j) {
                              to_yr.setError("Passed out year less than join year");
                              to_yr.requestFocus();
                          } else if (i == j) {
                              to_yr.setError("Check the year entered");
                              to_yr.requestFocus();
                          } else if (i &lt;= ab) {
                              frm_yr.setError("Enter a valid Year");
                              frm_yr.requestFocus();
                          } else if (j &lt;= ab) {
                              to_yr.setError("Enter a valid Year");
                              to_yr.requestFocus();
                          } else if (skill.getText().toString().length() == 0) {
                              skill.setError("Field Mandatory");
                              skill.requestFocus();
                          } else if (!textfieldValidator.validate(skill.getText().toString())) {
                              skill.setError("Enter a Valid Skill");
                              skill.requestFocus();
                          } else if (loc.getText().toString().length() == 0) {
                              loc.setError("Field Mandatory");
                              loc.requestFocus();
                          } else if (!textfieldValidator.validate(loc.getText().toString())) {
                              loc.setError("Enter a Valid Location");
                          } else {
                              next.setEnabled(false);
                              new CslIns(CSLActivity.this, mApp.getPreference().getString(Common.u_id, ""), fullName.getText().toString(), q,
                                      clgName.getText().toString(), conCent.getText().toString(), frm_yr.getText().toString(), to_yr.getText().toString(),
                                      skill.getText().toString(), loc.getText().toString(), ins, cIns).execute();
                                      /*startActivity(new Intent(getApplicationContext(), MailVerify.class));
                              finish();*/
                          }
                          break;
                  }
              }
          });
      }
  
      @Override
      public void onBackPressed() {
          if (exit) {
              mApp.getPreference().edit().putBoolean(Common.PAGE1, false).commit();
              super.onBackPressed();
              return;
          } else {
              Toast.makeText(this, "Press Back again to Cancel Signup Process.", Toast.LENGTH_SHORT).show();
              exit = true;
              new Handler().postDelayed(new Runnable() {
                  @Override
                  public void run() {
                      exit = false;
                  }
              }, 2000);
          }
      }
  }
  </code></pre>
  
  <p>my xml file </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.shuan.Project.signup.employee.CSLActivity"&gt;
  
      &lt;ProgressBar
          android:id="@+id/progress_bar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true" /&gt;
  
      &lt;ScrollView
          android:id="@+id/scroll_view"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:visibility="visible"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="@dimen/activity_horizontal_margin"
              android:orientation="vertical"&gt;
  
              &lt;android.support.design.widget.TextInputLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
                  &lt;EditText
                      android:id="@+id/fullName"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/standard_margin"
                      android:hint="Full Name"
                      android:imeOptions="actionNext"
                      android:inputType="textPersonName" /&gt;
  
              &lt;/android.support.design.widget.TextInputLayout&gt;
  
              &lt;Spinner
                  android:id="@+id/level"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="@dimen/standard_margin" /&gt;
  
              &lt;android.support.design.widget.TextInputLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="@dimen/standard_margin"&gt;
  
                  &lt;AutoCompleteTextView
                      android:id="@+id/clg_name"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:hint="@string/clg_name"
                      android:imeOptions="actionNext" /&gt;
              &lt;/android.support.design.widget.TextInputLayout&gt;
  
              &lt;android.support.design.widget.TextInputLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="@dimen/standard_margin"&gt;
  
                  &lt;AutoCompleteTextView
                      android:id="@+id/concent"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:hint="@string/concent"
                      android:imeOptions="actionNext"
                      android:singleLine="true" /&gt;
              &lt;/android.support.design.widget.TextInputLayout&gt;
  
              &lt;LinearLayout
                  android:id="@+id/yr"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="@dimen/standard_margin"
                  android:orientation="horizontal"&gt;
  
                  &lt;LinearLayout
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:orientation="horizontal"&gt;
  
                      &lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Joined"
                          android:textColor="#000"
                          android:textStyle="bold" /&gt;
  
                      &lt;EditText
                          android:id="@+id/frm_yr"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginLeft="@dimen/small_margin"
                          android:hint="Year"
                          android:imeOptions="actionNext"
                          android:inputType="numberDecimal"
                          android:maxLength="4"
                          android:singleLine="true" /&gt;
  
                  &lt;/LinearLayout&gt;
  
                  &lt;LinearLayout
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:orientation="horizontal"&gt;
  
                      &lt;TextView
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Passed :"
                          android:textColor="#000"
                          android:textStyle="bold" /&gt;
  
                      &lt;EditText
                          android:id="@+id/to_yr"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginLeft="@dimen/small_margin"
                          android:hint="Year"
                          android:imeOptions="actionNext"
                          android:inputType="numberDecimal"
                          android:maxLength="4"
                          android:singleLine="true" /&gt;
  
                  &lt;/LinearLayout&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;android.support.design.widget.TextInputLayout
                  android:id="@+id/layout_skill"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="@dimen/standard_margin"&gt;
  
                  &lt;MultiAutoCompleteTextView
                      android:id="@+id/skill"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:hint="Enter Your Skills"
                      android:imeOptions="actionNext"
                      android:inputType="text" /&gt;
              &lt;/android.support.design.widget.TextInputLayout&gt;
  
              &lt;android.support.design.widget.TextInputLayout
                  android:id="@+id/layout_location"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="@dimen/standard_margin"&gt;
  
                  &lt;AutoCompleteTextView
                      android:id="@+id/location"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:hint="@string/location"
                      android:imeOptions="actionDone"
                      android:inputType="textAutoComplete" /&gt;
              &lt;/android.support.design.widget.TextInputLayout&gt;
  
              &lt;Button
                  android:id="@+id/next"
                  android:layout_width="150dp"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center_horizontal"
                  android:layout_marginTop="@dimen/activity_horizontal_margin"
                  android:background="@drawable/signin_border"
                  android:text="START"
                  android:textAppearance="?android:textAppearanceMedium"
                  android:textColor="#fff"
                  android:textStyle="bold" /&gt;
  
          &lt;/LinearLayout&gt;
  
  
      &lt;/ScrollView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>log cat </p>
  
  <pre><code>    FATAL EXCEPTION: main
                                                               Process: com.shuan.Project, PID: 1432
                                                               java.lang.NumberFormatException: Invalid int: ""
                                                                   at java.lang.Integer.invalidInt(Integer.java:138)
                                                                   at java.lang.Integer.parseInt(Integer.java:358)
                                                                   at java.lang.Integer.parseInt(Integer.java:334)
                                                                   at com.shuan.Project.signup.employee.CSLActivity$1.afterTextChanged(CSLActivity.java:95)
                                                                   at android.widget.TextView.sendAfterTextChanged(TextView.java:7998)
                                                                   at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:9814)
                                                                   at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:990)
                                                                   at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:529)
                                                                   at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:224)
                                                                   at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:38)
                                                                   at android.view.inputmethod.BaseInputConnection.deleteSurroundingText(BaseInputConnection.java:252)
                                                                   at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:389)
                                                                   at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78)
                                                                   at android.os.Handler.dispatchMessage(Handler.java:111)
                                                                   at android.os.Looper.loop(Looper.java:194)
                                                                   at android.app.ActivityThread.main(ActivityThread.java:5649)
                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                   at java.lang.reflect.Method.invoke(Method.java:372)
                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
  </code></pre>