title: Android EPSON thermal Print data from web-view on click?If Printer Not Found?
body: <p>This is <a href="https://github.com/MadhuMLN/Epson_Sample/tree/master/Epson%20Sample%20Sdk/src/main/java/com/epson/epos2_printer" rel="noreferrer">my Code here</a> </p>
  
  <p>Here In my activity I am using Epson SDK to print data form web-view to android activity..</p>
  
  <p>So on Web-veiw  Onclick It will start Printer Activity and It will print</p>
  
  <p>What I am trying to do is..... OnClick from Web-view it will Open printer Activity so that it should print and Exit... </p>
  
  <p>So here I have created a Web-view... With the help of JS it sill Open my activity form Web-view (onclick) till now its fine... But I tried to Add print and exit.. onclick but Its not working... Because I need to select language and Printer Model....</p>
  
  <p>How ever in <a href="https://github.com/MadhuMLN/Epson_Sample/blob/master/Epson%20Sample%20Sdk/src/main/java/com/epson/epos2_printer/shared_DiscoveryActivity.java" rel="noreferrer">shared_DiscoveryActivity</a> I am adding Printer and saved it in shared prefs... so it will not ask any more... its working </p>
  
  <p>So Here My problem Is that </p>
  
  <p>1) Printer is Asking for Model No and Language So Can Any one suggest me How to Give them Manually instead of Selection
  here is the Old Code </p>
  
  <pre><code>mPrinter = new Printer(((SpnModelsItem) mSpnSeries.getSelectedItem()).getModelConstant(),
                             ((SpnModelsItem) mSpnLang.getSelectedItem()).getModelConstant(),
                             mContext);
  </code></pre>
  
  <p>For this I got these Values at <code>System.out.print</code></p>
  
  <pre><code>System.out:----- spnSeries -----android.widget.Spinner{24440249 VFED..C. ........ 0,444-466,516 #7f0e007b app:id/spnModel}
  System.out: ----- lang -----android.widget.Spinner{1a6c617c VFED..C. ........ 0,604-366,676 #7f0e007d app:id/spnLang}
  System.out: ----- printer -----com.epson.epos2.printer.Printer@b8250d6
  </code></pre>
  
  <p>2) This is the Major Problem 
  Here I am defining Printer In Shared Pinter So In my Code It will Check for Printer On that address</p>
  
  <p>But Here If printer Is not Found What should I do... </p>
  
  <p>Because On webview Printer Will start at Backend.. But App remains in webview So its crashing... Please suggest me on this kind</p>
  
  <p><strong>Update 1</strong></p>
  
  <p>Here I have Added a New File <a href="https://github.com/MadhuMLN/Epson_Sample/blob/master/Epson%20Sample%20Sdk/src/main/java/com/epson/epos2_printer/Test_P.java" rel="noreferrer">Test_P</a></p>
  
  <p>this will print in background without showing any info to User OnClick It will start Printing Here My problem is that If the Printer is Offline Or User is not on Same Network App Is Crashing instead of that I tried to Give a Message That Print is not avilable/Conffiged Please try again... but The Text or Alert Is not Showing.</p>
  
  <p>I am Getting This Error If printer is offline or Not Found</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.epson.epos2_printer, PID: 15489
  java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getString(int)' on a null object reference
  at com.epson.epos2_printer.ShowMsg.showException(ShowMsg.java:16)
  at com.epson.epos2_printer.Test_P.connectPrinter(Test_P.java:173)
  at com.epson.epos2_printer.Test_P.printData(Test_P.java:249)
  at com.epson.epos2_printer.Test_P.runPrintReceiptSequence(Test_P.java:295)
  at com.epson.epos2_printer.Test_P.access$200(Test_P.java:33)
  at com.epson.epos2_printer.Test_P$2.run(Test_P.java:128)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:150)
  at android.app.ActivityThread.main(ActivityThread.java:5408)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
  </code></pre>
  
  <p>Actually If Printer Not Available it should go to Config printer and Then print again ,,,But I tried to Make a msg But Its crashing Please Help me on this thanks....</p>