Q:

getting NumberFormatException: s == null after clicking button

I'm newbie in android.  After clicking this button(when nothing is in TextView i.e. it shows "" ) I'm getting NumberFormatException but in other cases it is working .I want to show toast message if nothing is in the String and my TextView initially  is 
                    android:id="@+id/text_view_result"

                    android:text=""

that button is
 buttonExpense.setOnClickListener(new View. OnClickListener() {
        @Override
        public void onClick(View v) {

            if (Integer.valueOf(result) < 0) {
                Toast.makeText(getActivity().getApplicationContext(), "Amount can't be negative", Toast. LENGTH_SHORT).show();
                return;
            }
            else if (Integer.valueOf(result) > 0) {
                Intent intent = new Intent(fa2, EditorActivity.class);
                intent.putExtra("result", result);
                startActivity(intent);

            }
            else if(Integer.valueOf(result) == 0) {

                Toast.makeText(getActivity().getApplicationContext(), "Amount can't be 0", Toast. LENGTH_SHORT).show();
                return;
            }
            else{
                Toast.makeText(getActivity().getApplicationContext(), "Please enter your amount", Toast. LENGTH_SHORT).show();
                return;
            }
        }

    });

method where result String is used is in method as given below
 private void onEqualButtonClicked() {
    int res = 0;
    try {
        int number = Integer.valueOf(tmp);
        int number2 = Integer.valueOf(resultTextView.getText().toString());
        switch (operator) {
            case "+":
                res = number + number2;
                break;
            case "/":
                res = number / number2;
                break;
            case "-":
                res = number - number2;
                break;
            case "X":
                res = number * number2;
                break;

        }
        result = String.valueOf(res);
        resultTextView.setText(result);

    }
    catch (Exception e) {
        e.printStackTrace();
    }

A:

An empty string is not a number.  What you want to do is check if it's a number first and then handle it. 
int number;
try {
  number = Integer.parseInt(result);
} catch (NumberFormatException exception) {
  // handle case where it's not a number
}

// perform logic where it is a number

