java - How to navigate from QR Code Reader to Paticular URL? -
The project is working fine but my problem is how to navigate with the QR code reader for the URL code to navigate Please tell me and help me AndroidBarcodeQrExample.java
the public class enhances AndroidBarcodeQrExample activity {permanent last string ACTION_SCAN = "com.google.zxing.client.android.SCAN"; Override public null on @reate (bundle saved instainstate) {super.naught (savedinstenstate); SetContentView (R.layout.activity_main); } Public Zero Scan QR (see v) {attempt {intent = new intent (ACTION_SCAN); Intent.putExtra ("SCAN_MODE", "QR_CODE_MODE"); StartActivityForResult (intent, 0); } {Except e) {}} Practical Zero onactivative result (int requestcode, inc. Result code, intent intent) {if (requestcode == 0) {if (resultCode == RESULT_OK) {string content = intent.getStringExtra ("SCAN_RESULT "); String format = intestine .getStringExtra ("SCAN_RESULT_FORMAT"); Toast toast = toast Make Text (this, "Content:" + Content + "Format:" + Format, Toast. LNNHHLAG); Toast.show (); }}}} main.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: Android = "http://schemas.android.com/apk/res/android" xmlns: tools = "http://schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = "Match_parent" Android: background = "#ffffff" Android: Orientation = "vertical" & gt; Android: Android: Android: Android: Layout_With = "250 DP" Android: Layout_Height = "80 DP" Android: Layout_Gravity = "Center" Android: Layout_margin = "10 DP" Android: Gravity = "Center" Android: OnClick = "scanQR "Android: text =" QR code "Android: textSize =" 18dp "& gt; & Lt; / Button & gt; & Lt; / LinearLayout & gt;
The browser has the code to open the URL in:
< Code> Intents BrowserIntent = New Intent (Intent.ACTION_VIEW, Uri.parse ("Your URL Here")); StartActivity (browserIntent);
Comments
Post a Comment