title: How do I parse a double and show it in an EdiText after calculation?
body: <p>I am a beginner, please just tell me what Im doing wrong with a hint. Dont tell me the solution just a good hint.  This is my code:</p>
  
  <pre><code>package com.dietel.preserve;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.text.Editable;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  import android.widget.EditText;
  import android.view.View.OnClickListener;
  
  
  public class MainActivity extends AppCompatActivity {
  
  private static final String TAG = "myApp";
  double fedExPivot1 = 35.00;
  double fedExPivot2 = 45.00;
  double fed1=850.00;
  double fed2= 750.00;
  double fedAdd= 2500.00;
  String p;
  double convertedWeight;
  double outShippingCost;
  String s;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
  
       EditText weight = (EditText) findViewById(R.id.editText);
      p= weight.getText().toString();
  
  
  
      convertedWeight= Double.parseDouble(p);
  
      final EditText textvew= (EditText) findViewById(R.id.editText4);
  
      Button calculate = (Button) findViewById(R.id.button);
  
     calculate.setOnClickListener(new OnClickListener() {
         @Override
         public void onClick(View v) {
             outShippingCost =shippingCost(convertedWeight);
             s=Double.toString(outShippingCost);
  
             textvew.setText(s);
  
  
         }
     });
  
  
  }
  
  public double shippingCost(double w) {
  
      if (w &lt; fedExPivot1) {
  
          w= w* fed1+fedAdd;
          w=w/100;
  
      } else if (w &gt; fedExPivot2){
          w= w*fed2/100;
  
      }else if(w&gt;= fedExPivot1){
  
          w= w*fed1/100;
      }
  
  
  
      return w;
  }
  }
  </code></pre>
  
  <p>I'm just trying to get a value from an editText and then convert it into a double and then show it inside another ediText after calculation. Please help me.</p>
  
  <p>This is my xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout      xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.dietel.preserve.MainActivity"&gt;
  
  &lt;TextView
      android:id="@+id/textView"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="39dp"
      android:layout_marginTop="150dp"
      android:text="@string/weight"
      android:textSize="18sp"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      tools:ignore="RtlHardcoded" /&gt;
  
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="24dp"
      android:layout_marginTop="34dp"
      android:text="@string/sale_price"
      android:textSize="18sp"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/textView"
      tools:ignore="RtlHardcoded" /&gt;
  
  &lt;Button
      android:id="@+id/button"
      android:layout_width="128dp"
      android:layout_height="39dp"
      android:text="@string/calculate"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintHorizontal_bias="0.566"
      android:layout_marginTop="77dp"
      app:layout_constraintTop_toBottomOf="@+id/editText"
      android:layout_marginBottom="8dp"
      app:layout_constraintBottom_toTopOf="@+id/editText4"
      app:layout_constraintVertical_bias="0.0" /&gt;
  
  &lt;EditText
      android:id="@+id/editText"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:ems="10"
      android:inputType="number"
      android:layout_marginRight="53dp"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      android:layout_marginTop="137dp"
      tools:ignore="LabelFor,RtlHardcoded"
      android:layout_marginLeft="8dp"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintHorizontal_bias="1.0" /&gt;
  
  &lt;EditText
      android:id="@+id/editText2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:ems="10"
      android:inputType="number"
      android:layout_marginTop="8dp"
      app:layout_constraintTop_toBottomOf="@+id/editText"
      android:layout_marginBottom="8dp"
      app:layout_constraintBottom_toTopOf="@+id/button"
      app:layout_constraintVertical_bias="0.0"
      android:layout_marginRight="53dp"
      app:layout_constraintRight_toRightOf="parent"
      tools:ignore="LabelFor,RtlHardcoded"
      android:layout_marginLeft="8dp"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintHorizontal_bias="1.0" /&gt;
  
  &lt;TextView
      android:id="@+id/textView3"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginBottom="114dp"
      android:layout_marginLeft="16dp"
      android:layout_marginTop="8dp"
      android:text="@string/total_cost"
      android:textSize="18sp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/textView2"
      app:layout_constraintVertical_bias="0.992"
      tools:ignore="RtlHardcoded" /&gt;
  
  &lt;TextView
      android:id="@+id/textView4"
      android:layout_width="112dp"
      android:layout_height="45dp"
      android:layout_marginBottom="8dp"
      android:layout_marginLeft="8dp"
      android:layout_marginRight="256dp"
      android:layout_marginTop="92dp"
      android:text="@string/enter_info2"
      android:textSize="24sp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintHorizontal_bias="0.0"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      app:layout_constraintVertical_bias="0.0"
      tools:ignore="RtlHardcoded"
      tools:text="Enter Info:" /&gt;
  
  &lt;EditText
      android:id="@+id/editText4"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginBottom="104dp"
      android:layout_marginLeft="8dp"
      android:layout_marginRight="53dp"
      android:ems="10"
      android:inputType="textPersonName"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintHorizontal_bias="1.0"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      tools:ignore="LabelFor,RtlHardcoded" /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>