예제 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
      case R.id.itemAbout:
        /*
         * Note by: Pranav
         * Description: Added call to About class
         * --Check call
         */
        Intent i = new Intent(this, AboutApp.class);
        startActivity(i);

        break;
      case R.id.itemLogout:
        SharedPreferences savedUser = getPreferences(MODE_PRIVATE);
        Editor editor = savedUser.edit();

        User user = application.getUser();
        user.save(editor, false);
        application.setUser(null);
        application.setCity(null);

        //			editor.clear();
        //			editor.commit();

        startActivity(new Intent(activity, Login.class));

        break;
      case R.id.itemChangeCity:
        Intent intent = new Intent(activity, Login.class);

        // Pass Pick to the Login activity to display the cities pop up
        intent.putExtra("ShowCity", true);
        startActivity(intent);

        break;

      case R.id.itemMainMenu:
        startActivity(new Intent(activity, CityMenu.class));
        break;
    }
    return false;
  }