Fetch the data from Session and set to the other activity(without doing logout)

29 Views Asked by At

I am trying to do session manager but not able to get the data after opening the app again

public void createLoginSession(String name, String email,String playerid){
        // Storing login value as TRUE
        editor.putBoolean(IS_LOGIN, true);
        // Storing name in pref
        editor.putString(KEY_NAME, name);
        // Storing email in pref
        editor.putString(KEY_EMAIL, email);
        editor.putString(KEY_UserID,playerid);
        editor.commit();
    }

I want my data in second activity

session = new SessionManager(getApplicationContext());
        session.checkLogin();

        if (session.isLoggedIn() == true) {
            session.checkLogin();
            hashMap = session.getUserDetails();
            user_id= (String) hashMap.get(session.KEY_UserID);
            //  Toast.makeTetApplicationContext(),"driver id"+driver_id, Toast.LENGTH_LONG).show();
            System.out.println("session  data:---" + user_id);

        } else {
            Toast.makeText(getApplicationContext(), "You aren't logged in.", Toast.LENGTH_LONG).show();
            Intent register = new Intent(getApplicationContext(), LoginActivity.class);
            startActivity(register);
        }
0

There are 0 best solutions below