title: Error when trying save data in sqlite
body: <p>Hi guys i just got this error when trying to create database and save data in the table Please Help </p>
  
  <blockquote>
    <p>(Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()')</p>
  </blockquote>
  
  <p>Database.java</p>
  
  <pre><code>public class Database extends SQLiteOpenHelper   {
  
  final static String Database_Name = "Jordangym.db";
  final static String Table_Name = "Body";
  
  
  public Database(Context context) {
      super(context, Database_Name, null, 1);
      SQLiteDatabase db = this.getWritableDatabase();
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {
  
      db.execSQL("Create table "+Table_Name+"(Date TEXT , Height TEXT , Wieght TEXT , Biceps TEXT , Chest TEXT , Waiste TEXT )");
  
  
  }
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  
      db.execSQL("DROP TABLE IF EXISTS"+Table_Name);
      onCreate(db);
  
  }
  
  public boolean insertdata (String Height ,String Wieght, String Biceps, String Chest , String Waiste ){
  
      SQLiteDatabase db=this.getWritableDatabase();
      ContentValues values = new ContentValues();
      values.put("Date", System.currentTimeMillis());
      values.put("Height",Height);
      values.put("Wieght",Wieght);
      values.put("Biceps",Biceps);
      values.put("Chest",Chest);
      values.put("Waiste",Waiste);
  
      long result=db.insert(Table_Name,null,values);
  
      if (result==-1){
          return false;
      }
      else {
          return true;
      }
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>BodyMeasure.java</p>
  
  <pre><code>public class BodyMeasure extends AppCompatActivity {
  
  EditText EdtHeight, EdtWieght, EdtChest, EdtWaiste, EdtBicep;
  Button buHeight;
  Database mydb;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.body_measure);
  
      mydb = new Database(this);
  
      EdtBicep = (EditText)findViewById(R.id.edtBiceps);
      EdtChest = (EditText)findViewById(R.id.edtChest);
      EdtHeight = (EditText)findViewById(R.id.edtHeight);
      EdtWieght = (EditText)findViewById(R.id.edtWight);
      EdtWieght =(EditText)findViewById(R.id.edtWaiste);
  
      buHeight = (Button)findViewById(R.id.buHeight);
      BuHeightAdd();
  
  }
  
  
  public void BuHeightAdd (){
      buHeight.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
             boolean IsInserted = mydb.insertdata(
                     EdtHeight.getText().toString(),
                     EdtWieght.getText().toString(),
                     EdtBicep.getText().toString(),
                     EdtChest.getText().toString(),
                     EdtWaiste.getText().toString());
  
  
              if (IsInserted == true )
                  Toast.makeText(BodyMeasure.this,"Done",Toast.LENGTH_LONG).show();
              else
                  Toast.makeText(BodyMeasure.this,"Error",Toast.LENGTH_LONG).show();
          }
  
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>body_measure.xml</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  
      android:layout_height="500dp"
      android:layout_width="fill_parent"
      &gt;
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.qais.jordangym.BodyMeasure"&gt;
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="80dp"&gt;
  
          &lt;RelativeLayout
              android:orientation="horizontal"
              android:layout_width="fill_parent"
              android:layout_height="80dp"&gt;
  
          &lt;ImageView
              android:layout_width="70dp"
              android:layout_height="80dp"
              android:background="@drawable/appicon"/&gt;
          &lt;TextView
              android:id="@+id/txtHeight"
              android:layout_width="wrap_content"
              android:layout_height="80dp"
              android:text="Height"
              android:layout_marginLeft="80dp"
              android:gravity="center"/&gt;
          &lt;EditText
              android:id="@+id/edtHeight"
              android:layout_width="fill_parent"
              android:layout_height="80dp"
              android:layout_marginLeft="50dp"
              android:layout_marginRight="50dp"
              android:layout_alignLeft="@+id/txtHeight"
              android:layout_alignRight="@+id/buHeight"/&gt;
              &lt;Button
                  android:id="@+id/buHeight"
                  android:layout_width="50dp"
                  android:layout_height="80dp"
                  android:text="S"
                  android:layout_alignParentTop="true"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentEnd="true"
  
                  /&gt;
  
          &lt;/RelativeLayout&gt;
  
      &lt;/LinearLayout&gt;
      &lt;RelativeLayout
          android:layout_marginTop="90dp"
          android:layout_width="fill_parent"
          android:layout_height="80dp"&gt;
          &lt;ImageView
              android:layout_width="70dp"
              android:layout_height="80dp"
              android:background="@drawable/appicon"/&gt;
          &lt;TextView
              android:id="@+id/txtWeight"
              android:layout_width="wrap_content"
              android:layout_height="80dp"
              android:text="Wieght"
              android:layout_marginLeft="80dp"
              android:gravity="center"/&gt;
          &lt;EditText
              android:id="@+id/edtWight"
              android:layout_width="fill_parent"
              android:layout_height="80dp"
              android:layout_marginLeft="135dp"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout
          android:layout_marginTop="180dp"
          android:layout_width="fill_parent"
          android:layout_height="80dp"&gt;
          &lt;ImageView
              android:layout_width="70dp"
              android:layout_height="80dp"
              android:background="@drawable/appicon"/&gt;
          &lt;TextView
              android:id="@+id/txtBiceps"
              android:layout_width="wrap_content"
              android:layout_height="80dp"
              android:text="Biceps"
              android:layout_marginLeft="80dp"
              android:gravity="center"/&gt;
          &lt;EditText
              android:id="@+id/edtBiceps"
              android:layout_width="fill_parent"
              android:layout_height="80dp"
              android:layout_marginLeft="135dp"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout
          android:layout_marginTop="270dp"
          android:layout_width="fill_parent"
          android:layout_height="80dp"&gt;
          &lt;ImageView
              android:layout_width="70dp"
              android:layout_height="80dp"
              android:background="@drawable/appicon"/&gt;
          &lt;TextView
              android:id="@+id/txtChest"
              android:layout_width="wrap_content"
              android:layout_height="80dp"
              android:text="Chest"
              android:layout_marginLeft="80dp"
              android:gravity="center"/&gt;
          &lt;EditText
              android:id="@+id/edtChest"
              android:layout_width="fill_parent"
              android:layout_height="80dp"
              android:layout_marginLeft="135dp"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout
          android:layout_marginTop="360dp"
          android:layout_width="fill_parent"
          android:layout_height="80dp"&gt;
          &lt;ImageView
              android:layout_width="70dp"
              android:layout_height="80dp"
              android:background="@drawable/appicon"/&gt;
          &lt;TextView
              android:id="@+id/txtWaiste"
              android:layout_width="wrap_content"
              android:layout_height="80dp"
              android:text="Waiste"
              android:layout_marginLeft="80dp"
              android:gravity="center"/&gt;
          &lt;EditText
              android:id="@+id/edtWaiste"
              android:layout_width="fill_parent"
              android:layout_height="80dp"
              android:layout_marginLeft="135dp"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout
          android:layout_marginTop="450dp"
          android:layout_width="fill_parent"
          android:layout_height="80dp"&gt;
          &lt;ImageView
              android:layout_width="70dp"
              android:layout_height="80dp"
              android:background="@drawable/appicon"/&gt;
          &lt;TextView
              android:id="@+id/txtOptional"
              android:layout_width="wrap_content"
              android:layout_height="80dp"
              android:text="Optional"
              android:layout_marginLeft="80dp"
              android:gravity="center"/&gt;
      &lt;/RelativeLayout&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;/ScrollView&gt;</code></pre>
  </div>
  </div>
  </p>