EditText の値を取得し、それを 1.21 で除算する必要があります....エラーはどこにありますか
private TextWatcher filterTextWatcher = new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int end) {
}
public void afterTextChanged(Editable s) {
double imponibile21;
Importo.getText().toString();
if (spinnerIva.getSelectedItem().toString().equals("21%")){
Double value = Double.valueOf(""+Importo);
imponibile21 = (value/1.21);
NumberFormat formatter = NumberFormat.getCurrencyInstance();
String Imponibile = formatter.format(imponibile21 );
mImponibile.setText(Imponibile);
エラー:
09-18 22:59:56.617: E/AndroidRuntime(27425): java.lang.NumberFormatException: Invalid double: "android.widget.EditText{421f9c38 VFED..CL .F...... 0,664-1080,781 #7f08000b app:id/ed_importo_fattura}"
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.StringToReal.invalidReal(StringToReal.java:63)
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.StringToReal.initialParse(StringToReal.java:114)
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.StringToReal.parseDouble(StringToReal.java:263)
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.Double.parseDouble(Double.java:295)
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.Double.valueOf(Double.java:332)
09-18 22:59:56.617: E/AndroidRuntime(27425): at fatture.acquisti.Inserisci_fatture$2.afterTextChanged(Inserisci_fatture.java:178)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.widget.TextView.sendAfterTextChanged(TextView.java:7841)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:9754)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:970)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:497)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:676)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.view.inputmethod.BaseInputConnection.commitText(BaseInputConnection.java:196)
09-18 22:59:56.617: E/AndroidRuntime(27425): at com.android.internal.widget.EditableInputConnection.commitText(EditableInputConnection.java:183)
09-18 22:59:56.617: E/AndroidRuntime(27425): at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:279)
09-18 22:59:56.617: E/AndroidRuntime(27425): at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.os.Handler.dispatchMessage(Handler.java:99)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.os.Looper.loop(Looper.java:137)
09-18 22:59:56.617: E/AndroidRuntime(27425): at android.app.ActivityThread.main(ActivityThread.java:5328)
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.reflect.Method.invokeNative(Native Method)
09-18 22:59:56.617: E/AndroidRuntime(27425): at java.lang.reflect.Method.invoke(Method.java:511)
09-18 22:59:56.617: E/AndroidRuntime(27425): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
09-18 22:59:56.617: E/AndroidRuntime(27425): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
09-18 22:59:56.617: E/AndroidRuntime(27425): at dalvik.system.NativeStart.main(Native Method)