コード例 #1
0
  /**
   * Get the current package version.
   *
   * @return The current version.
   */
  private String getVersion() {
    String result = "";
    try {
      PackageManager manager = getActivity().getPackageManager();
      PackageInfo info = manager.getPackageInfo(getActivity().getPackageName(), 0);

      result = String.format("%s (%s)", info.versionName, info.versionCode);
    } catch (NameNotFoundException e) {
      Log.w(Constants.TAG, "Unable to get application version: " + e.getMessage());
      result = "Unable to get application version.";
    }

    return result;
  }
コード例 #2
0
  private void setProgressCircleWithHandler(boolean value) {
    Message msg = Message.obtain();

    if (value) {
      msg.what = BackgroundStatusHandler.BACKGROUND_STATUS_HANDLER_ENABLE;
    } else {
      msg.what = BackgroundStatusHandler.BACKGROUND_STATUS_HANDLER_DISABLE;
    }

    if (mMessenger != null) {
      try {
        mMessenger.send(msg);
      } catch (RemoteException e) {
        Log.w(Constants.TAG, "Exception sending message, Is handler present?", e);
      }
    }
  }