this.printerDev.printerPaper( new IPrinterCallback.Stub() {
@Override
public void onException(int i, String s) throws RemoteException {
showMessage(getResources().getString(R.string.print_status)+ i + s);
}
@Override
public void onLength(long l, long l1) throws RemoteException {
}
@Override
public void onRealLength(double v, double v1) throws RemoteException {
}
@Override
public void onComplete() throws RemoteException {
String endTime = getCurTime();
showMessage(getResources().getString(R.string.print_end_time)+endTime);
}
});
public interface IonLengthPrinterCallback extends IPrinterCallback {
void onException(int i, String s) throws RemoteException;
default void onLength(long l, long l1) throws RemoteException {
// 默认实现为空
}
default void onRealLength(double v, double v1) throws RemoteException {
// 默认实现为空
}
void onComplete() throws RemoteException;
}
public void getPrintState(View v){
try{
Log.d(TAG,"come in!");
this.printerDev.printerPaper(new IonLengthPrinterCallback() {
@Override
public void onException(int i, String s) throws RemoteException {
showMessage(getResources().getString(R.string.print_status)+ i + s);
}
@Override
public void onComplete() throws RemoteException {
String endTime = getCurTime();
showMessage(getResources().getString(R.string.print_end_time)+endTime);
}
@Override
public IBinder asBinder() {
return null;
}
});