package chriseldridge.caddy;

import android.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.net.Uri;

import com.google.zxing.Result;
import me.dm7.barcodescanner.zxing.ZXingScannerView;

public class MainActivity extends AppCompatActivity implements ZXingScannerView.ResultHandler {
    private ZXingScannerView scannerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        scannerView = new ZXingScannerView(this);
        scannerView.setResultHandler(this);
    }

    public void QRScanner(View view) {
        setContentView(scannerView);

        scannerView.startCamera();
    }

    @Override
    public void onPause() {
        super.onPause();

        scannerView.stopCamera();
        setContentView(R.layout.activity_main);
    }
    
    @Override
    public void handleResult(Result rawResult) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Scan Result");
        builder.setMessage(rawResult.getText());
        AlertDialog alert1 = builder.create();
        alert1.show();

        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=22d-ZjYn8BE&feature=youtu.be")));
    }
}

@@ -27,40 +27,8 @@
 y;%0A%0A
-import android.app.AlertDialog;%0A
 impo
@@ -178,16 +178,45 @@
 net.Uri;
+%0Aimport android.widget.Toast;
 %0A%0Aimport
@@ -1055,220 +1055,68 @@
     
-AlertDialog.Builder builder = new AlertDialog.Builder(this);%0A        builder.setTitle(%22Scan Result%22);%0A        builder.setMessage(rawResult.getText());%0A        AlertDialog alert1 = builder.create();%0A        alert1
+Toast.makeText(this, rawResult.getText(), Toast.LENGTH_LONG)
 .sho

replace alert dialog with toast message