roth_a Posted May 8, 2012 Share Posted May 8, 2012 Bonjour à tous, Je vous expose ici mon problème le plus clairement possible, et ci après le code que j'ai écrit. Layout 1 : EditText Activity 1 : Je récupère l'EditText Layout 2 : TextView Activity 2 : jJ'ouvre juste la layout 2 Ce que je cherche à faire c'est Récuperer mon String que je fou dans l'EditText pour le mettre dans la TextView de l'Activity2 Ce que j'ai fait dans l'activity 1 : this.monMot = (EditText)this.findViewById(R.id.monMot); this.valider =(Button)this.findViewById(R.id.valider); this.valider.setOnClickListener(this); private void jaicliquesurvalider() { Toast.makeText(this, this.monMot.getText().toString(), Toast.LENGTH_SHORT).show(); this.monMot.setText(""); Intent monIntent = new Intent(this, Resultat.class); monIntent.putExtra("monMot", this.monMot.getText().toString()); this.startActivity(monIntent); } public void onClick(View v) { if (v.equals(this.valider)){ this.jaicliquesurvalider(); } Ce qui à pour effet de m'ouvrir l'activity 2 mais m'afficher Sous forme de pop up ce que je viens de rentrer dans l'EditText, or j'aurai voulu la récupérer dans ma TextView Je vous remercie de m'avoir lu, en èsperant que vous pourrez m'aider ! Link to comment Share on other sites More sharing options...
Lineo Posted May 8, 2012 Share Posted May 8, 2012 Bonsoir, Ta popup, c'est ton Toast qui s'affiche dans ta deuxième Activity. Tu assignes une chaîne de caractères vide à ton mot avant de l'envoyer dans ton Intent. Je pense que c'est pour ça. Link to comment Share on other sites More sharing options...
roth_a Posted May 9, 2012 Author Share Posted May 9, 2012 Je te remercie pour ta réponce Lineo, qui pui est j'ai trouvé ma réponce sur ce lien http://www.tutos-android.com/changement-vues-android Le sujet peux être fermé ! :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.