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

  • Replies:3
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Sep 15, 2017 4:24:30 AM via Website

Button signin;
EditText editTextUsername,editTextPassword;
protected void onCreate(Bundle savedInstanceState) {


    signin.setOnClickListener(new View.OnClickListener() {
        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);
                Intent intent=new Intent(MainActivity.this,MainActivity.class);


i can't go to next page.

  • Forum posts: 13

Sep 15, 2017 3:44:02 PM via Website

Hay, Cjmah, put JOptionPane.showMessageDialog(ex, Exception); into try and catch and share, what exception you get from it?

  • Forum posts: 2

Sep 19, 2017 9:17:30 AM via Website

in these lines what is the value you are getting ,I don't think you are getting value from editext, Use getText() for getting text and convert to string using toString()

String username=String.valueOf(editTextUsername);
String password=String.valueOf(editTextPassword);

— modified on Sep 19, 2017 9:37:41 AM

  • Forum posts: 8

Sep 20, 2017 8:30:51 AM via Website

Hi there,

Instead of using
String username=String.valueOf(editTextUsername);

try using
String username = editTextUsername.getText().toString();

then do the same with password field too.