Convert value from EditText to Double - Android User Interface

Android examples for User Interface:EditText

Description

Convert value from EditText to Double

Demo Code


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

public class Main {
    public static double toDouble(EditText editText) {
        try {//from  www  .ja  v  a 2s.c om
            return Double.valueOf(editText.getText().toString());
        } catch (NumberFormatException e) {
            return 0.0;
        }
    }
}

Related Tutorials