试图消除错误..
找不到符号方法解析(int)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == BARCODE_READER_REQUEST_CODE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (resultCode.Startswith("http://") || resultCode.startsWith("https://")) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, URI.parse(resultCode));
startActivity(browserIntent);
}
答案 0 :(得分:0)
以下是解决方案:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == BARCODE_READER_REQUEST_CODE) {
if (resultCode == CommonStatusCodes.SUCCESS) {
if (data != null) {
Barcode barcode = data.getParcelableExtra(BarcodeCaptureActivity.BarcodeObject);
String value = barcode.displayValue;
if (value.startsWith("http://") || value.startsWith("https://")) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(value));
startActivity(i);
}
} else
{
Log.e("your_tag","no value captured");
}
} else Log.e("your_tag","barcode error ");
} else super.onActivityResult(requestCode, resultCode, data);
}