Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:19:51+00:00 2026-05-24T22:19:51+00:00

I am new to android can someone help me please, following is the code

  • 0

I am new to android can someone help me please, following is the code i tried to run for scanning the barcode but it gives an error whenever i click the button it says force to close what should i do help me please.

this.btnCheck = (Button) findViewById(R.id.btnsearch);
this.btnCheck.setOnClickListener(
new OnClickListener() {
public void onClick(View v)
{
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
}
}
);   
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = data.getStringExtra("SCAN_RESULT");
Toast.makeText(this, "the scaned code is = "+ contents, Toast.LENGTH_SHORT).show(); 
// Handle successful scan
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}

Edit Logcat:

this is the log cat now Starting:

Intent { act=com.google.zxing.client.android.SCAN (has extras) } from pid 359 thread exiting with uncaught exception (group=0x40015560) 

08-18 01:52:00.995: ERROR/AndroidRuntime(359): FATAL EXCEPTION: main 

08-18 01:52:00.995: ERROR/AndroidRuntime(359): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.google.zxing.client.android.SCAN (has extras) } 

08-18 01:52:00.995: ERROR/AndroidRuntime(359): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:19:52+00:00Added an answer on May 24, 2026 at 10:19 pm

    This exception probably means that the device you are trying to use doesn’t have BarcodeScanner installed. You can use this code somewhere in your app to check, and prompt the user to install it form the market if they do not already have.

          //Check for Barcode scanner, if not found put up an alert that allows user to install it.
        PackageManager pm = getPackageManager();
        try {
            ApplicationInfo appInfo = pm.getApplicationInfo("com.google.zxing.client.android", 0);
        } catch (NameNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
             new AlertDialog.Builder(this)
                .setTitle("WARNING:")
                .setMessage("You don't have Barcode Scanner installed. Please install it.")
                 .setCancelable(false)
                .setNeutralButton("Install it now", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {         
                              Uri uri = Uri.parse("market://search?q=pname:com.google.zxing.client.android");
                              startActivity(new Intent(Intent.ACTION_VIEW, uri));
                        }
                })
                .show();
        }
    

    Edit: Change this line:

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

    to this:

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

    I highly suggest you go to this page Read it thoroughly, and then follow the two links that are underneath the code example and look at all of the code that it shows. Even if you do not understand it, it will give you some idea what is capable via Intents with the BarcodeScanner app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please can anyone help me out with this problem? This code below works perfectly
Can someone please help me understand pending intent ? Some examples would really help
I know that eclipse can do this, can Intellij via the new Android support
Can someone explain to me why this AlertDialog crashes? package com.clicker; import android.app.Activity; import
Can someone please tell me how can I easily display every record from sqllite
Morning, I would love help with my specific code but if you're busy any
I'm new to android and I'm need a little help understanding how to move
I have a variable android=/media/New Volume_/android-sdk-linux_86 I get an error saying that it cannot
i want to draw i grid like Link can some one please help me
I'm pretty new to android can some one give me a better idea which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.