Reuse already existing instance of print manager

This commit is contained in:
Sebastián Katzer 2016-08-02 16:13:52 +02:00
parent 62ae354984
commit c75bd32982
3 changed files with 3 additions and 3 deletions

View File

@ -143,7 +143,6 @@ public class Printer extends CordovaPlugin {
cordova.getThreadPool().execute(new Runnable() { cordova.getThreadPool().execute(new Runnable() {
@Override @Override
public void run() { public void run() {
PrintManager pm = new PrintManager(cordova.getActivity());
List<PrintServiceInfo> services = pm.getEnabledPrintServices(); List<PrintServiceInfo> services = pm.getEnabledPrintServices();
Boolean available = services.size() > 0; Boolean available = services.size() > 0;

View File

@ -24,7 +24,6 @@ package de.appplant.cordova.plugin.printer.ext;
import android.content.Context; import android.content.Context;
import android.print.PrintJob; import android.print.PrintJob;
import android.print.PrintJobId; import android.print.PrintJobId;
import android.print.PrinterInfo;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;

View File

@ -47,8 +47,10 @@ public abstract class Meta {
try { try {
return cls.getDeclaredMethod(name, params); return cls.getDeclaredMethod(name, params);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
return null; e.printStackTrace();
} }
return null;
} }
/** /**