title: Android Studio: Add radiobutton string to database
body: <p>I am creating an application - inside Android Studio - where people need to fill in a form. Now I can put all of the data inside of a database (SQLite). Except for the data which is chosen by a group of radiobuttons. </p>
  
  <p>With the code I have now, I'm only making a reference.
  <a href="https://i.stack.imgur.com/BBP4e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BBP4e.png" alt="Database output"></a></p>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.odisee.photoboothapp;
  
  import android.graphics.Typeface;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.Window;
  import android.widget.Button;
  import android.widget.RadioGroup;
  import android.widget.EditText;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class Form_Database extends AppCompatActivity {
  DatabaseHelper myDb;
  
  RadioGroup editEducation;
  EditText editName, editSurname, editEmail;
  Button btnAddData;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      getSupportActionBar().hide();
      setContentView(R.layout.activity_form__database);
  
      myDb = new DatabaseHelper(this);
  
      editName = (EditText)findViewById(R.id.edit_Name);
      editSurname = (EditText)findViewById(R.id.edit_Surname);
      editEmail = (EditText)findViewById(R.id.edit_Email);
      editEducation = (RadioGroup)findViewById(R.id.radioButtonChoice);
  
      btnAddData = (Button)findViewById(R.id.btnSend);
  
      addData();
      test();
  }
  
  public void addData() {
      btnAddData.setOnClickListener(
              new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      boolean isInserted = myDb.insertData(editName.getText().toString(), editSurname.getText().toString(), editEmail.getText().toString(), editEducation.toString());
  
                      if(isInserted == true) {
                          Toast.makeText(Form_Database.this,"Data inserted",Toast.LENGTH_LONG).show();
                      }
                      else {
                          Toast.makeText(Form_Database.this,"Data not inserted",Toast.LENGTH_LONG).show();
                      }
                  }
              }
      );
  }
  
  protected void test() {
      Typeface myTypeface = Typeface.createFromAsset(getAssets(), "AvenirNextLTPro-Bold.otf");
      TextView myTextview = (TextView)findViewById(R.id.contact_form_description);
      TextView textView2 = (TextView)findViewById(R.id.edit_Surname);
      TextView textView3 = (TextView)findViewById(R.id.edit_Name);
      TextView textView4 = (TextView)findViewById(R.id.btnSend);
      TextView textView5 = (TextView)findViewById(R.id.radioBedrijskunde);
      myTextview.setTypeface(myTypeface);
      textView2.setTypeface(myTypeface);
      textView3.setTypeface(myTypeface);
      textView4.setTypeface(myTypeface);
      textView5.setTypeface(myTypeface);
  }
  }
  </code></pre>
  
  <p>DatabasHelper.java</p>
  
  <pre><code>package com.odisee.photoboothapp;
  
  import android.content.ContentValues;
  import android.content.Context;
  import android.database.sqlite.SQLiteDatabase;
  import android.database.sqlite.SQLiteOpenHelper;
  
  /**
  * Created by Lorenzo on 28-4-2017.
  */
  
  public class DatabaseHelper extends SQLiteOpenHelper {
  public static final String DATABASE_NAME = "Studentengegevens.db";
  public static final String TABLE_NAME = "student_table";
  
  public static final String ID = "ID";
  public static final String SURNAME = "SURNAME";
  public static final String NAME = "NAME";
  public static final String EMAIL = "EMAIL";
  public static final String EDUCATION = "EDUCATION";
  
  public DatabaseHelper(Context context) {
      super(context, DATABASE_NAME, null, 1);
  }
  
  @Override
  public void onCreate(SQLiteDatabase db) {
      db.execSQL("CREATE TABLE " + TABLE_NAME + " (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, SURNAME TEXT, EMAIL TEXT, EDUCATION 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 name, String surname, String email, String education) {
      SQLiteDatabase db = this.getWritableDatabase();
  
      ContentValues contentValues = new ContentValues();
      contentValues.put(NAME, name);
      contentValues.put(SURNAME, surname);
      contentValues.put(EMAIL, email);
      contentValues.put(EDUCATION, education);
  
      long result = db.insert(TABLE_NAME, null, contentValues);
  
      if(result == -1) {
          return false;
      }
      else {
          return true;
      }
  }
  
  }
  </code></pre>
  
  <p>How can I change the reference into the actual String of the 'checked' radiobutton?</p>