简体   繁体   中英

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!

I think the best way is to read the google tutorial. I read it some time ago and it was very helpful:

http://developer.android.com/intl/es/training/basics/data-storage/databases.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM