jeudi 21 avril 2016

How can I save data in Android Studio using the library SQLite?

I want to save a person's data in some mSQLite tables I've already made but I don't know how to do so or how to use the library. Can someone please help me??

This is the code I have right now:

Button guardar;
Button volver;
EditText name;
EditText email;
EditText password;
EditText age;
EditText address;
EditText phone;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_registro);
    guardar = (Button) findViewById(R.id.guardar);
    guardar.setOnClickListener(this);
    volver = (Button) findViewById(R.id.volver);
    volver.setOnClickListener(this);
}

@Override
public void onClick (View v){
    switch (v.getId()) {
        case R.id.guardar:

            Toast.makeText(Registro.this, "¡Los datos se han guardado con éxito!", Toast.LENGTH_LONG).show();
            startActivity(new Intent(this, Casa.class));
            break;
        case R.id.volver:
            startActivity(new Intent(this, MainActivity.class));
            break;
    }
}

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire