I am doing a simple login app where i need to pass the user id to subsequent screens. But,i am not getting the username field to a variable.
public static String user;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText username = (EditText)findViewById(R.id.etUserName);
EditText password = (EditText)findViewById(R.id.etPwd);
Button blogin = (Button)findViewById(R.id.bLogin);
user = username.getText().toString();// Here user variable is blank!!!!!!!!!!!!!!!
Kindly help!!!