Android Question App crushing without error on new device

buras3

Active Member
Licensed User
Longtime User
Hello

I have an app that works on older devices that's prints with my own library . when I install on new device it's crush without error when i print (network) .

what can I do ?

thank you
 

jahswant

Well-Known Member
Licensed User
Longtime User
Hello

I have an app that works on older devices that's prints with my own library . when I install on new device it's crush without error when i print (network) .

what can I do ?

thank you
Please show us the code that do the printing and the full stock of the error !
 
Upvote 0

buras3

Active Member
Licensed User
Longtime User
printer file:
package michael.vegs;
import com.brother.ptouch.sdk.*;

import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.*;

@Version(3.0f)
@ShortName("BrotherPrintSDK")
@DependsOn(values={"BrotherPrintLibrary"})
public class BrotherPrintSDK {
  
   public void print(final BA ba, final String filePath,final String printerIP,final String LblSize,final String PModel){
      
    Thread trd = new Thread(new Runnable(){
     @Override
       public void run() {
           String x;
     Printer myPrinter = new Printer();
     PrinterInfo myPrinterInfo = new PrinterInfo();
     PrinterStatus printResult = new PrinterStatus();
     LabelInfo mLabelInfo=new LabelInfo();
    
     x="1";
       myPrinterInfo = myPrinter.getPrinterInfo();
       //myPrinterInfo.printerModel=PrinterInfo.Model.QL_720NW;
      // myPrinterInfo.printerModel=PModel;
        if (PModel=="QL_720NW") {
            myPrinterInfo.printerModel=PrinterInfo.Model.QL_720NW;
        } else {
            myPrinterInfo.printerModel=PrinterInfo.Model.QL_820NWB;
        }
    
       x="2";
       myPrinterInfo.printMode=PrinterInfo.PrintMode.FIT_TO_PAGE;
       myPrinterInfo.port=PrinterInfo.Port.NET;
       myPrinterInfo.paperSize = PrinterInfo.PaperSize.CUSTOM;
       myPrinterInfo.orientation = PrinterInfo.Orientation.PORTRAIT;
       myPrinterInfo.numberOfCopies = 1;
       myPrinterInfo.ipAddress=printerIP;
        //myPrinter.skipStatusCheck=true;
        mLabelInfo.labelNameIndex=LabelInfo.QL700.valueOf(LblSize).ordinal();
       //mLabelInfo.labelNameIndex=5;  W29H90 W38H90
       x="3";
       mLabelInfo.isAutoCut = true;
       mLabelInfo.isEndCut =true;
      
       myPrinter.setPrinterInfo(myPrinterInfo);
       myPrinter.setLabelInfo(mLabelInfo);

     x="4";
       printResult=myPrinter.printFile(filePath);
        
       ba.raiseEventFromDifferentThread(this , null, 0, "myevent_metadata", true, new Object[] {printResult.errorCode.toString() + x});
     //      }
       }
        });
        trd.start();
                    }
 
        }
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…