I'm trying to pass an intent to check a session name and if it matches "Admin" then I want a button to become visible.
When the toast is called the session name is completely blank
I have sent intents from the Login class like so:
 public void onClick(View v) {
                final String username = usernameET.getText().toString();
                final String password = passwordET.getText().toString();    
                boolean success = db.Login(username, password);       
                boolean adminSuccess = db.adminLogin(username, password);
                if(success)
                {
                    Log.d("login", "user logged");                  
                    session = true;                     
                    Intent i = new Intent(Login.this, MainActivity.class);
                    Intent a = new Intent(Login.this, MyAccount.class);
                    Intent h = new Intent(Login.this, Homepage.class);
                    i.putExtra("loginSuccess", session);
                    i.putExtra("sessionName", username);      
                    a.putExtra("sessionName", username);
                    h.putExtra("sessionName", username);
                    startActivity(a);
                    startActivity(i); 
                    startActivity(h);
                }
                else if (adminSuccess)
                {
                    Log.d("login", "admin logged");                 
                    session = true;                     
                    Intent i = new Intent(Login.this, MainActivity.class);
                    Intent a = new Intent(Login.this, MyAccount.class);
                    Intent h = new Intent(Login.this, Homepage.class);
                    i.putExtra("loginSuccess", session);
                    h.putExtra("loginSuccess", session);
                    i.putExtra("sessionName", username);      
                    a.putExtra("sessionName", username);
                    h.putExtra("sessionName", username);
                    startActivity(a);                  
                    startActivity(h);
                    startActivity(i); 
                }
                else
                {
                    Log.d("login", "user not logged");
                }
            }
I then call it in my MainActivity.java (which works) and in my Homepage.java (which doesn't)
Like so in the Homepage's onCreate() method:
//Check if admin is logged in for editting
        final Intent intent = getIntent();  
        boolean loginSuccess = intent.getBooleanExtra("loginSuccess", true);
        String sessionName = intent.getStringExtra("sessionName");
        Toast.makeText(Homepage.this, sessionName, Toast.LENGTH_LONG).show();       
        if (sessionName == "Admin")
            {                   
                editBtn.setVisibility(View.VISIBLE);
            }
        } 
It works in the same way in my MainActivity
Am I meant to do it in the onResume() method instead? Not too sure why it isn't passing
