Bonjour,
mon problème est le suivant.
Sur mon appli je souhaite prendre une information entrée dans un setter et par la suite l'envoyer dans une autre activité (via le getter qui est approprié).
Voici mon code pour l'enregistrement des informations:
Maintenant voici l'action qui est réalisé quand on sélectionne un voyage
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 public void refreshPartage(){ partageVoyage.clear(); Bundle b = getIntent().getExtras(); user = b.getParcelable("Voyage partagé"); // ************************** CHARGEMENT DES EVENEMENTS ************************** // SoapObject requete = new SoapObject(NAMESPACE, METHOD_GET_PARTAGE_VOYAGE); //requete.addProperty("id_param", 1); /*requete.addProperty("date_fin", date_fin);*/ SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); MarshalDate mdb =new MarshalDate(); MarshalDate mdf = new MarshalDate(); mdb.register(envelope); mdf.register(envelope); envelope.setOutputSoapObject(requete); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { //this is the actual part that will call the webservice androidHttpTransport.call(SOAP_ACTION_PARTAGEVOYAGE, envelope); // SoapObject resultSOAP = (SoapObject) envelope.getResponse(); SoapObject resultSOAP = (SoapObject) envelope.bodyIn; if (resultSOAP == null) Toast.makeText(Partagevoyage.this,"Rien reçu", Toast.LENGTH_LONG).show(); //récuperer des voyages partagés Vector liste_events = (Vector) resultSOAP.getProperty("return"); int nbre_event = liste_events.size(); for(int i = 0; i<nbre_event; i++){ Voyage mesVoys = new Voyage(); SoapObject event = (SoapObject) liste_events.get(i); int nbre_champs = event.getPropertyCount(); for(int j=0; j<nbre_champs; j++){ SoapObject champs = (SoapObject) event.getProperty(j); String keys = champs.getProperty("key").toString(); if(keys.compareTo("id_voyage_serveur")==0){ String id_vyg = champs.getProperty("value").toString(); id_vyg_serv = Integer.parseInt(id_vyg); mesVoys.setid_voyage(id_vyg_serv); } if(keys.compareTo("nom_voyage")==0){ String nom_vyg = champs.getProperty("value").toString(); mesVoys.setnom_voyage(nom_vyg); } if(keys.compareTo("detail_voyage")==0){ String detail_vyg = champs.getProperty("value").toString(); mesVoys.setdetail_voyage(detail_vyg); } } partageVoyage.add(mesVoys); aap.notifyDataSetChanged(); } }catch (Exception e) { e.printStackTrace(); } // }
Si vous avez des idées .....
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 ListePartageVoyage.setOnItemClickListener(new OnItemClickListener() { @Override @SuppressWarnings("unchecked") public void onItemClick(AdapterView<?> a, View v, int position, long id) { ->voy.get******(); ->Toast.makeText(Partagevoyage.this,"nom ***** " + voy.get******(), Toast.LENGTH_LONG).show(); // Intent intent = new Intent(***.this, ***.class); intent.putExtra("Visu voyage",(Parcelable)voy); intent.putExtra ("id_voyage", id_vyg_serv); startActivity(intent); } });
Loïc
Partager