Search in sources :

Example 1 with TextParsedResult

use of com.google.zxing.client.result.TextParsedResult in project zxing by zxing.

the class CaptureActivity method handleResult.

private void handleResult(Result result) {
    ParsedResult parsed = ResultParser.parseResult(result);
    Intent intent;
    if (parsed.getType() == ParsedResultType.URI) {
        intent = new Intent(Intent.ACTION_VIEW, Uri.parse(((URIParsedResult) parsed).getURI()));
    } else {
        intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.putExtra("query", ((TextParsedResult) parsed).getText());
    }
    startActivity(intent);
}
Also used : ParsedResult(com.google.zxing.client.result.ParsedResult) TextParsedResult(com.google.zxing.client.result.TextParsedResult) URIParsedResult(com.google.zxing.client.result.URIParsedResult) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)1 ParsedResult (com.google.zxing.client.result.ParsedResult)1 TextParsedResult (com.google.zxing.client.result.TextParsedResult)1 URIParsedResult (com.google.zxing.client.result.URIParsedResult)1