I'm doing a program for Android
with access to database. Then I have an edit button, which when I pulse I deactivate a create button. To modify a text.
Then I want that when I click again on the edit button (which at this moment has text on the button, "Save"). Well, do a series of things, my problem is that I do not know that I have to put a condition in the if to know if you have pressed the button when its value is Save.
I copy what is related to the edit button, the if how can you see I have it empty. Have if someone can give me a hand in what I have to put in the condition. Thank you very much in advance.
private Button btnEditar;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnEditar = (Button) findViewById(R.id.btnEditar);
btnEditar.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnEditar:
// Si hay alguna receta seleccionada permitimos su modificación
if(c!=null){
editReceta.setText(txtReceta.getText());
btnCrear.setEnabled(false);
btnEditar.setText("Guardar");
if(...){ db.actualizar(c.getId(),editNombre.getText().toString(),editReceta.getText().toString());
btnCrear.setEnabled(true);
btnEditar.setText("Editar");
}
}
break;
}