android - app stops after scanning qr code -


i wants automatically navigate site after scanning qr code,hear code crashes after scanning qr code.

import com.google.zxing.result; import me.dm7.barcodescanner.zxing.zxingscannerview;  public class mainactivity extends appcompatactivity implements zxingscannerview.resulthandler {     private zxingscannerview mscannerview;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);      }      public void qrscanner(view view){           mscannerview = new zxingscannerview(this);   // programmatically initialize scanner view         setcontentview(mscannerview);          mscannerview.setresulthandler(this); // register ourselves handler scan results.         mscannerview.startcamera();         // start camera      }      @override     public void onpause() {         super.onpause();         mscannerview.stopcamera();           // stop camera on pause     }      @override     public void handleresult(result rawresult) {         // result here          log.e("handler", rawresult.gettext()); // prints scan results         log.e("handler", rawresult.getbarcodeformat().tostring()); // prints scan format (qrcode)           webview webview = (webview)this.findviewbyid(r.id.webview);         webview.getsettings().setjavascriptenabled(true);         webview.loaddatawithbaseurl("", rawresult.tostring(), "text/html", "utf-8", "");     } } 


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -