package com.example.android.mycalculator;
    import android.os.Bundle;
    import android.support.v7.app.ActionBarActivity;
    import android.view.View;
    import android.widget.EditText;
    import android.widget.TextView;
    public class MainActivity extends ActionBarActivity {
        int qty = 0;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
 String val = ((EditText)findViewById(R.id.input1)).getText().toString();
        int num1 = Integer.valueOf(val);
        String val1 = ((EditText)findViewById(R.id.input2)).getText().toString();
        int num2 = Integer.valueOf(val1);
        }
        private void display(int number) {
            TextView quantityTextView = (TextView) findViewById(
                    R.id.quantity_text_view);
            quantityTextView.setText("" + number);
        }
    /*for getting the input values into some variable**/
    /* for adding the input numbers**/
        public void add(View view){
            qty = num1 + num2;
            display(qty);
        }
/*for subtracting two input numbs**/
        public void subtract(View view){
            qty = num1 - num2;
            display(qty);
        }
        public void divide(View view){
            qty = num1 / num2;
            display(qty);
        }
        public void multiply(View view){
            qty = num1 * num2;
            display(qty);
        }
    }
The code got crashed when I ran it on my device through android studio. I have a doubt in the code because I'm a beginner in coding. Pls find the error in it.The program takes two input numbers and performs actions like adding,subtracting,dividing and multiplying. It then shows the output as a TextView below.The program ran well in the computer but crashed on the device. No errors were shown while running.
 
     
    