Example #1
0
  private Uri getViewImage(View view) {
    try {
      File outputDir = getActivity().getCacheDir(); // context being the Activity pointer
      File outputFile = File.createTempFile("screen", ".png", outputDir);

      view.setDrawingCacheEnabled(true);
      Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
      try {
        view.setDrawingCacheEnabled(false);
        FileOutputStream out = new FileOutputStream(outputFile);
        try {
          bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
          out.flush();
          return Uri.fromFile(outputFile);
        } finally {
          IOUtils.closeQuietly(out);
        }
      } finally {
        bitmap.recycle();
      }
    } catch (IOException e) {
      Services.Log.error(e);
      return null;
    }
  }
  @Override
  public Map<String, String> getDynamicComboValues(
      String serviceName, Map<String, String> inputValues) {
    if (LOG_ENABLED)
      Services.Log.info(
          LOG_TAG, String.format("getDynamicComboValues(%s, %s)", serviceName, inputValues));

    return getDefaultServer().getDynamicComboValues(serviceName, inputValues);
  }