I am building an application which requires user authentication. First time a user opens the app should login or register to continue to the home screen of the app which loa
If you wish you put login screen as dialog box, which may help you. For creating login dialog you can use below code.
// Create Object of Dialog class
final Dialog login = new Dialog(this);
// Set GUI of login screen
login.setContentView(R.layout.login_dialog);
login.setTitle("Login to Pulse 7");
// Init button of login GUI
Button btnLogin = (Button) login.findViewById(R.id.btnLogin);
Button btnCancel = (Button) login.findViewById(R.id.btnCancel);
// Attached listener for login GUI button
btnLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(Pulse7LoginDialogActivity.this,
"Login Sucessfull", Toast.LENGTH_LONG).show();
}
});
btnCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
login.dismiss();
}
});
// Make dialog box visible.
login.show();