Zxing barcode scanner implementation intent

I've been looking everywhere regarding implementing a barcode scanner into my application/ I've already included the code which'll enable the user to scan if the Barcode scanner is installed but I now need something to prompt the user to download the application if it isn't already installed? I followed an example to get me this far.

Here is my code

    package com.example.zxingscan;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class Main extends Activity {
  public void onCreate(Bundle savedInstanceState) {



    HandleClick hc = new HandleClick();



  private class HandleClick implements OnClickListener{

    public void onClick(View arg0) {

      Intent intent = new Intent("com.google.zxing.client.android.SCAN");


        case R.id.butQR:

          intent.putExtra("SCAN_MODE", "QR_CODE_MODE");


      startActivityForResult(intent, 0);    //Barcode Scanner to scan for us
  public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
      TextView tvStatus=(TextView)findViewById(R.id.tvStatus);
      TextView tvResult=(TextView)findViewById(R.id.tvResult);
      if (resultCode == RESULT_OK) {
      } else if (resultCode == RESULT_CANCELED) {
        tvStatus.setText("Press a button to start a scan.");
        tvResult.setText("Scan cancelled.");


First of all create a dialog that briefly explains the situation and that suggests to install the free ZXing scanner app from Google Play. Add a Cancel and an Install button. I'm not going to explain how to do that here. Just take a look at this AlertDialog.Builder tutorial for example.

Upon user confirmation (Install button click) you just need to start the following intent:

startActivity(new Intent(Intent.ACTION_VIEW,

market protocol Uris can be used to open app detail pages from the Google Play market. See this Android documentation page for more information.

Need Your Help

Getting NaN output in C#

c# nan

I'm trying to get a simple result on a console app in C#

lxc - Linux container can not access device node

linux lxc lirc

I used the following configuration to bind the lirc0 into the container.