1. Download our Official Android App: Forums for Android!

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

Discussion in 'Android Development' started by mah chong jun, Sep 15, 2017.

  1. mah chong jun

    mah chong jun Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Jun 22, 2016

    Jun 22, 2016
    2
    0
    5
    Male
    Code (Text):
    1.  
    2. Button signin;
    3. EditText editTextUsername,editTextPassword;
    4. [USER=1021285]@override[/USER]
    5. protected void onCreate(Bundle savedInstanceState) {
    6. super.onCreate(savedInstanceState);
    7. setContentView(R.layout.activity_main);
    8.  
    9. signin=(Button)findViewById(R.id.login);
    10. editTextUsername=(EditText)findViewById(R.id.username);
    11. editTextPassword=(EditText)findViewById(R.id.password);
    12.  
    13. signin.setOnClickListener(new View.OnClickListener() {
    14. [USER=1021285]@override[/USER]
    15. public void onClick(View v) {
    16. String username=String.valueOf(editTextUsername);
    17. String password=String.valueOf(editTextPassword);
    18.  
    19. if(username.equals("admin") && password.equals("admin"))
    20. {
    21. Intent intent=new Intent(MainActivity.this,SecondPage.class);
    22. startActivity(intent);
    23. }
    24. else
    25. {
    26. Intent intent=new Intent(MainActivity.this,MainActivity.class);
    27. }
    28.  
    29. }
    30. });
    31. }
    32.  
    I cannot go to next page.
     

    Advertisement

  2. nyt1972

    nyt1972 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Sep 20, 2017

    Sep 20, 2017
    3
    0
    5
    Check that if you added SecondPage Activity in your Manifest.
     

Share This Page

Loading...