コード例 #1
0
  public void dispose() {
    try {
      LocalBroadcastManager.getInstance(mContext).unregisterReceiver(mScreenStateReceiver);
      mHandler.removeMessages(0);
      mHandler = null;
      mScreenStateReceiver = null;

    } catch (Exception e) {
      Debug.exception(e);
    }
  }
コード例 #2
0
    @Override
    public void commandCompleted(int id, int exitcode) {
      Bitmap bmp = null;
      FileOutputStream out = null;
      try {
        int size = mSettings.screenshotSize();
        bmp = ImageUtil.getResizedImage(path, size);
        if (bmp != null) {
          Date dt = new Date();
          String date =
              SimpleDateFormat.getDateTimeInstance(
                      SimpleDateFormat.SHORT, SimpleDateFormat.MEDIUM, sLocale)
                  .format(dt);
          date = date.replace(':', '-'); // .replace(' ', '_');
          String fName = PREFIX + "[" + date + "]" + "[" + dt.getTime() + "]" + ".jpg";
          out = new FileOutputStream(FileUtil.getExternalFullPath(mContext, fName));
          bmp.compress(Bitmap.CompressFormat.JPEG, 60, out);

          File del = new File(path);
          del.delete();

          new FileSender(mContext, FileType.SCREENSHOT).start();
        }
      } catch (Exception e) {
        ACRA.getErrorReporter().handleSilentException(e);

      } finally {
        if (bmp != null && !bmp.isRecycled()) {
          bmp.recycle();
          bmp = null;
        }
        if (out != null) {
          try {
            out.close();

          } catch (IOException e) {
            Debug.exception(e);
          }
          out = null;
        }
      }
    }