From e7ce5142805b176141d2c50dff8d73e67cbb2f06 Mon Sep 17 00:00:00 2001 From: Cristian Cardozo Date: Fri, 22 Apr 2022 13:20:55 -0300 Subject: [PATCH] fixes #96 #100 --- .../FlutterPluginPdfViewerPlugin.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java b/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java index 27570865..0243e749 100644 --- a/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java +++ b/android/src/main/java/pt/tribeiro/flutter_plugin_pdf_viewer/FlutterPluginPdfViewerPlugin.java @@ -85,13 +85,14 @@ public void run() { if (pageResult == null) { Log.d(TAG, "Retrieving page failed."); result.notImplemented(); + } else { + mainThreadHandler.post(new Runnable() { + @Override + public void run() { + result.success(pageResult); + } + }); } - mainThreadHandler.post(new Runnable() { - @Override - public void run() { - result.success(pageResult); - } - }); break; default: result.notImplemented(); @@ -200,7 +201,6 @@ private String getPage(String filePath, @Nullable Integer pageNumber) { ret = createTempPreview(bitmap, filePath, pageNumber); } finally { page.close(); - renderer.close(); } return ret; } catch (Exception ex) {