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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
| public class WelcomeInterface extends Activity{
Button bdt2;
Button bdt;
EditText datarriv;
Button smart;
String d;
EditText datdep;
Button reg;
String a;
EditText region;
String r;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.welcom);
region=(EditText)findViewById(R.id.Region);
datarriv=(EditText)findViewById(R.id.datarriv);
reg=(Button)findViewById(R.id.reg);
datdep=(EditText)findViewById(R.id.datdep);
bdt=(Button)findViewById(R.id.widget34);
bdt.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intentt =new Intent(WelcomeInterface.this,SimpleCalendarViewActivity.class);
startActivity(intentt);
}
});
bdt2=(Button)findViewById(R.id.calfin);
bdt2.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intentt =new Intent(WelcomeInterface.this,SimpleCalendarViewArriv.class);
startActivity(intentt);
}
});
smart=(Button)findViewById(R.id.smartGuide);
smart.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
//Intent intentt =new Intent(WelcomeInterface.this,Favoris.class);
//startActivity(intentt);
}
});
//On récupère l'objet Bundle envoyé par l'autre Activity
Bundle objetbunble = this.getIntent().getExtras();
if (objetbunble != null && objetbunble.containsKey("dd")){
d=this.getIntent().getStringExtra("dd");
datdep.setText(d);
}
else{
d="Error";
}
//On récupère l'objet l'autre Bundle envoyé par la 2em activiter l'autre Activity
Bundle objetbundle = this.getIntent().getExtras();
if (objetbundle != null && objetbundle.containsKey("hh")){
a=this.getIntent().getStringExtra("hh");
datarriv.setText(a);
}
else{
a="Error";
}
reg.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
final AlertDialog.Builder builder =new AlertDialog.Builder(WelcomeInterface.this);
final CharSequence[] items = {"Nabeul", "Sousse", "Hamamet","Bizert","djerba","tabarka"};
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
r=(String) items[item];
}
});
builder.setTitle("choisir votre region");
builder.setCancelable(false);
builder.setPositiveButton("ok",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
region.setText(r);
}
});
builder.setNegativeButton("Annuler",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
}
} |
Partager