| 12
 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
 
 |  
package helloWorld.namespace;
 
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.content.Intent; 
 
public class HelloWorldActivity extends Activity
{
    /** Called with the activity is first created. */
    //@Override
    public void onCreate(Bundle b)
    {
        super.onCreate(b);
        setContentView(R.layout.main);
 
 
    OnClickListener ButtonG = new OnClickListener() 
    { 
    //@Override
     public void onClick(View actuelView) 
     { 
 
    EditText identifiant = (EditText) findViewById(R.id.saisie); 
    String identifiantStr = identifiant.getText().toString(); 
 
     // On met en place le passage entre les deux activités sur ce Listener 
     Intent intent = new Intent(HelloWorldActivity.this, 
                                          IdentifiantActivity.class); 
 
     intent.putExtra("identifiant", identifiantStr); 
     startActivity(intent); 
     }  
 
 
    };
 
    //On récupere le bouton souhaité et on lui affecte le Listener 
 
    Button bouton = (Button) findViewById(R.id.G); 
    bouton.setOnClickListener(ButtonG);
 
}
} | 
Partager