Skip to content

Instantly share code, notes, and snippets.

@triskell
Created November 30, 2013 11:41
Show Gist options
  • Save triskell/7718008 to your computer and use it in GitHub Desktop.
Save triskell/7718008 to your computer and use it in GitHub Desktop.
Helloworld activity
@Override
protected void onStart(){
super.onStart();
Button b = (Button)findViewById(R.id.buttonHello);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String name = ((EditText)findViewById(R.id.etNom)).getText().toString();
Toast.makeText(view.getContext(), "Hello world from " + name + " !", Toast.LENGTH_LONG)
.show();
Intent helloIntent = new Intent("hwb.helloworldbis.HELLO");
helloIntent.putExtra("name", name);
startActivity(helloIntent);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment