My application crashed :     import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.widget.EditText;

    public class MainActivity extends AppCompatActivity {
        EditText a;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            a = (EditText) findViewById(R.id.a);

            int i = Integer.parseInt(a.getText().toString());
      }
    }


 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.shoaib.demo/com.example.shoaib.demo.MainActivity}: java.lang.NumberFormatException: For input string: ""
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2892)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3027)
                      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
                      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:101)
                      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:73)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1786)
                      at android.os.Handler.dispatchMessage(Handler.java:106)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6656)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
                   Caused by: java.lang.NumberFormatException: For input string: ""
                      at java.lang.Integer.parseInt(Integer.java:629)
                      at java.lang.Integer.parseInt(Integer.java:652)
                      at com.example.shoaib.demo.MainActivity.onCreate(MainActivity.java:17)
                      at android.app.Activity.performCreate(Activity.java:7117)
                      at android.app.Activity.performCreate(Activity.java:7108)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1262)