protected void doGetUserProfile(final long userId, final SocializeAction action) {

    if (userId >= 0 && (currentUser == null || !currentUser.getId().equals(userId))) {
      UserUtils.getUser(
          getActivity(),
          userId,
          new UserGetListener() {

            @Override
            public void onGet(User user) {
              // Set the user details into the view elements
              currentUser = user;
              setUserDetails(user, action);
              countdown();
            }

            @Override
            public void onError(SocializeException error) {
              countdown();
              showError(getContext(), error);
            }
          });
    } else {
      countdown();
    }
  }
  /*
   * (non-Javadoc)
   * @see com.socialize.networks.AbstractSocialNetworkSharer#doShare(android.app.Activity, com.socialize.entity.Entity, com.socialize.entity.PropagationUrlSet, java.lang.String, com.socialize.networks.SocialNetworkListener, com.socialize.api.action.ActionType)
   */
  @Override
  protected void doShare(
      Activity context,
      Entity entity,
      PropagationInfo urlSet,
      String comment,
      SocialNetworkListener listener,
      ActionType type) {

    Tweet tweet = new Tweet();

    switch (type) {
      case SHARE:
        if (StringUtils.isEmpty(comment)) comment = "Shared " + entity.getDisplayName();
        break;
      case LIKE:
        comment = "\u2764 likes " + entity.getDisplayName();
        break;
      case VIEW:
        comment = "Viewed " + entity.getDisplayName();
        break;
    }

    StringBuilder status = new StringBuilder();

    if (StringUtils.isEmpty(comment)) {
      status.append(entity.getDisplayName());
    } else {
      status.append(comment);
    }

    status.append(", ");
    status.append(urlSet.getEntityUrl());

    tweet.setText(status.toString());

    UserSettings settings = UserUtils.getUserSettings(context);

    if (settings != null && settings.isLocationEnabled()) {
      tweet.setLocation(LocationUtils.getLastKnownLocation(context));
      tweet.setShareLocation(true);
    }

    TwitterUtils.tweet(context, tweet, listener);
  }
  public void testProfileActivityLoadsCorrectData() throws Throwable {

    TestUtils.setupSocializeOverrides(true, true);
    Instrumentation.ActivityMonitor monitor =
        TestUtils.setUpActivityMonitor(this, ProfileActivity.class);

    final User dummy = new User();

    dummy.setId(69L);
    dummy.setFirstName("foo");
    dummy.setLastName("bar");

    SocializeUserUtils userUtils =
        new SocializeUserUtils() {
          @Override
          public void getUser(Context context, long id, UserGetListener listener) {
            listener.onGet(dummy);
          }

          @Override
          public User getCurrentUser(Context context) {
            return dummy;
          }
        };

    SocializeAccess.setUserUtilsProxy(userUtils);

    // Ensure facebook is enabled
    ConfigUtils.getConfig(getContext()).setFacebookAppId("1234567890");
    ConfigUtils.getConfig(getContext())
        .setTwitterKeySecret(
            "U18LUnVjULkkpGoJ6CoP3A", "RiIljnFq4RWV9LEaCM1ZLsAHf053vX2KyhJhmCOlBE");

    UserUtils.showUserSettings(TestUtils.getActivity(this));

    Activity waitForActivity = monitor.waitForActivityWithTimeout(5000);

    assertNotNull(waitForActivity);

    // Check that the user's name is displayed
    assertTrue(TestUtils.lookForText(waitForActivity, "foo", 10000));
    assertTrue(TestUtils.lookForText(waitForActivity, "bar", 10000));

    waitForActivity.finish();
  }
  /* (non-Javadoc)
   * @see com.socialize.demo.DemoActivity#executeDemo()
   */
  @Override
  public void executeDemo(String text) {

    ActionUtils.getActionsByUser(
        this,
        UserUtils.getCurrentUser(this).getId(),
        0,
        PAGE_SIZE,
        new ActionListListener() {

          @Override
          public void onList(ListResult<SocializeAction> result) {
            handleSocializeResult(result);
          }

          @Override
          public void onError(SocializeException error) {
            handleError(GetActionsByUserActivity.this, error);
          }
        });
  }