protected void captureTokens(String url) {

    Log.e(TAG, "captureTokens : " + url);

    Token token = new Token();

    String[] tokens = url.split("#");

    for (String temp_token : tokens) {

      Log.e(TAG, "captureTokens : temp_token : " + temp_token);

      if (temp_token.startsWith("access_token")) {

        String[] token_parts = temp_token.split("=");
        String _token = token_parts[1];

        token.setAccessToken(_token);

        setRefreshing(false);

        break;
      }
    }

    // Set a short expiration time
    Calendar expiration = Calendar.getInstance();
    expiration.add(Calendar.MINUTE, 15);
    token.setExpiration(expiration);

    token.store(this);
  }
  @Override
  protected void onResume() {
    super.onResume();

    EventBusSingleton.register(this);

    if (Token.isLoggedIn(this)) {
      InstagramDemoLogin.this.setResult(RESULT_OK);
      finish();
    }
  }