Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.widget.EditText;

public class Main {
    public static int parseInt(EditText editText) {
        return parseInt(editText, 0);
    }

    public static int parseInt(EditText editText, int defaultValueIfInputIsEmpty) {
        String inputText = editText.getText().toString();
        return "".equals(inputText) ? defaultValueIfInputIsEmpty : Integer.parseInt(inputText);
    }
}