1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
public class AfficherDetails extends Toolbar
{
private TextView dateVille, titre;
private ImageButton favoris, favoris_del;
@Override
public void onCreate(Bundle savedInstanceState)
{
DatabaseLigne_Favoris manifBDD = new DatabaseLigne_Favoris(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.afficher_details);
dateVille = (TextView) findViewById(R.id.lieu);
titre = (TextView) findViewById(R.id.selection);
favoris =(ImageButton)findViewById(R.id.favoris);
favoris_del =(ImageButton)findViewById(R.id.favoris_del);
Bundle objetbunble = this.getIntent().getExtras();
dateVille.setText(objetbunble.getString("date"));
titre.setText(objetbunble.getString("titre"));
}
public void ajouter_favoris (View view)
{
try
{
DatabaseLigne_Favoris manifBDD = new DatabaseLigne_Favoris(this);
manifBDD.open();
manif.setDate(Fonctions.dateJJMMAAAA((String) dateD.getText()));
manifBDD.insertManif(manif);
manifBDD.close();
Toast.makeText(AfficherDetails.this,"Manifestation ajoutée à vos Favoris.",Toast.LENGTH_SHORT).show();
favoris.setEnabled(false);
}
catch (Exception e)
{
Toast.makeText(AfficherDetails.this,"PROBLEME de sauvegarde du favori, opération avortée.",Toast.LENGTH_LONG).show();
}
}
public void supprimer_favoris (View view)
{
try
{
DatabaseLigne_Favoris manifBDD = new DatabaseLigne_Favoris(this);
manifBDD.open();
manifBDD.removeManifById(id_Fav);
manifBDD.close();
Toast.makeText(AfficherDetails.this,"Manifestation supprimée de vos Favoris.",Toast.LENGTH_SHORT).show();
setResult(RESULT_OK, new Intent());
finish();
}
catch (Exception e)
{
Toast.makeText(AfficherDetails.this,"PROBLEME de suppression du favori, opération avortée.",Toast.LENGTH_LONG).show();
}
}
} |
Partager