Question

In my application i used tab widget for home activity. it's include 4 tabs. unregistered user can access only two tabs. for access other two(favorite and offers) user should register.

I used Android User Session Management using SharedPreferences for the session management.

when i click offers tab it load login activity,But when i tried to go back it display the offers activity.

I want to hide the offers and favorite tabs contents when user not log.

This is the Offers Activity

public class Offers extends Activity {

    SessionManager session;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.offers_layout);


        session = new SessionManager(getApplicationContext());

        session.checkLogin();

        HashMap<String, String> user = session.getUserDetails();

        String name = user.get(SessionManager.KEY_NAME);

        String email = user.get(SessionManager.KEY_EMAIL);

        Toast.makeText(getApplicationContext(), email, Toast.LENGTH_LONG).show();
        }

      //Content

}

Other classes are same as the link mentioned above.

I want to hide offers content when user not login. Can any one help me?

Was it helpful?

Solution

You have to do in on resume of the activity follow the steps

  1. on resume check for which tab has to enabled or disabled.

  2. then use following lonk to enable or disable tabs link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top