• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

cannot go to another page and please solve the problem for me.

mah chong jun

Lurker
Jun 22, 2016
2
0
Code:
Button signin;
EditText editTextUsername,editTextPassword;
[USER=1021285]@override[/USER]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

signin=(Button)findViewById(R.id.login);
editTextUsername=(EditText)findViewById(R.id.username);
editTextPassword=(EditText)findViewById(R.id.password);

signin.setOnClickListener(new View.OnClickListener() {
[USER=1021285]@override[/USER]
public void onClick(View v) {
String username=String.valueOf(editTextUsername);
String password=String.valueOf(editTextPassword);

if(username.equals("admin") && password.equals("admin"))
{
Intent intent=new Intent(MainActivity.this,SecondPage.class);
startActivity(intent);
}
else
{
Intent intent=new Intent(MainActivity.this,MainActivity.class);
}

}
});
}

I cannot go to next page.
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones