Creating the alert message and save functionality (not finish)
This commit is contained in:
parent
6ff8e099eb
commit
a2625fe318
@ -4,6 +4,11 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
public class AddCity extends AppCompatActivity {
|
||||
|
||||
@ -16,5 +21,22 @@ public class AddCity extends AppCompatActivity {
|
||||
setSupportActionBar(toolbarAddCity);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
Button button = (Button) findViewById(R.id.btnSaveCity);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
EditText editTextnewCity = (EditText) findViewById(R.id.editTextNewCity);
|
||||
String newCity = (String) editTextnewCity.getText().toString();
|
||||
if(editTextnewCity.length() == 0)
|
||||
{
|
||||
editTextnewCity.setError("Please, enter a city name");
|
||||
}
|
||||
else
|
||||
System.out.println(newCity);
|
||||
//Ajoute la ville a une base de données
|
||||
//Prélève le texte avec le get
|
||||
//S'il est vide on l'alert et on fais rien
|
||||
//Sinon écran d'accueil qui change
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user