Skip to content

Instantly share code, notes, and snippets.

@ColeMurray
Created April 13, 2014 07:03
Show Gist options
  • Save ColeMurray/10572505 to your computer and use it in GitHub Desktop.
Save ColeMurray/10572505 to your computer and use it in GitHub Desktop.
public class LoginScreen extends Activity {
Button createButton = (Button) findViewById(R.id.uButton);
EditText uField = (EditText) findViewById(R.id.uField);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_screen);
getUsername();
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}
}
private void getUsername()
{
createButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
Toast toast = Toast.makeText(getApplicationContext(), uField.getText().toString(), Toast.LENGTH_LONG);
toast.show();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment