From c75bd32982b3e6fbce12524630a81020116560d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Tue, 2 Aug 2016 16:13:52 +0200 Subject: [PATCH] Reuse already existing instance of print manager --- src/android/Printer.java | 1 - src/android/ext/PrintManager.java | 1 - src/android/reflect/Meta.java | 4 +++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/android/Printer.java b/src/android/Printer.java index 7825b41..ee3877c 100644 --- a/src/android/Printer.java +++ b/src/android/Printer.java @@ -143,7 +143,6 @@ public class Printer extends CordovaPlugin { cordova.getThreadPool().execute(new Runnable() { @Override public void run() { - PrintManager pm = new PrintManager(cordova.getActivity()); List services = pm.getEnabledPrintServices(); Boolean available = services.size() > 0; diff --git a/src/android/ext/PrintManager.java b/src/android/ext/PrintManager.java index 8a7ed9e..d184473 100644 --- a/src/android/ext/PrintManager.java +++ b/src/android/ext/PrintManager.java @@ -24,7 +24,6 @@ package de.appplant.cordova.plugin.printer.ext; import android.content.Context; import android.print.PrintJob; import android.print.PrintJobId; -import android.print.PrinterInfo; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationHandler; diff --git a/src/android/reflect/Meta.java b/src/android/reflect/Meta.java index 71a5767..a030e03 100644 --- a/src/android/reflect/Meta.java +++ b/src/android/reflect/Meta.java @@ -47,8 +47,10 @@ public abstract class Meta { try { return cls.getDeclaredMethod(name, params); } catch (NoSuchMethodException e) { - return null; + e.printStackTrace(); } + + return null; } /**