java Android显示在浏览器中打开的警报
我是Android原生开发的新手, 我想在警告消息中显示“在浏览器中打开”图标
Case:
I have a QR code scanned and showing the result in a toast or Alert.
In the scanned Result, I want to Show up "Open In Browser" with the code result or Alert message
挑战在于我无法实现此功能。请让我知道如何做到这一点,以便我可以进一步学习Android
My Manifest goes like this:
<uses-permission 安卓:name="安卓.permission.CAMERA" />
<application
安卓:allowBackup="true"
安卓:icon="@mipmap/ic_launcher"
安卓:label="@string/app_name"
安卓:supportsRtl="true"
安卓:theme="@style/AppTheme">
<activity 安卓:name=".MainActivity">
<intent-filter>
<action 安卓:name="安卓.intent.action.MAIN" />
<category 安卓:name="安卓.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And my Result handler
@Override
public void handleResult(Result rawResult) {
// Do something with the result here
Log.v("TAG", rawResult.getText()); // Prints scan results
Log.v("TAG", rawResult.getBarcodeFormat().toString()); // Prints the scan format (qrcode, pdf417 etc.)
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("UTQode Result");
builder.setMessage(rawResult.getText());
AlertDialog alert1 = builder.create();
alert1.show();
// Toast.makeText(getApplicationContext(), "My Message",
// Toast.LENGTH_SHORT).show();
Toast.makeText(this, rawResult.getText(), Toast.LENGTH_LONG).show();
// If you would like to resume scanning, call this method below:
mScannerView.resumeCameraPreview(this);
}
I am testing with the above code, but I need to open the alert result and Query it in Browser
共 (0) 个答案