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

  • SEARCH
  • Home
  • 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 7562505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:25:28+00:00 2026-05-30T13:25:28+00:00

I am creating a qr code reader application and I took help from the

  • 0

I am creating a qr code reader application and I took help from the zXing resource and after running my application on my phone it says “Found URL” and does not redirect me to the specific link of the qr code. It takes me back to my main activity.
My project name is “scan” and I have added the core.jar file. I also have one layout page i.e main.xml with a button named “scan qr code” and the activity name is “ScanActvity.java” the whole coding of my project is as:

ScanActivity.java

package com.scan.qr;

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

public class ScanActivity extends Activity {
/** Called when the activity is first created. */
Button btnScan;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    btnScan = (Button) findViewById(R.id.button1);

    btnScan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            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 intent) {
           if (requestCode == 0) {
              if (resultCode == RESULT_OK) {
                 String contents = intent.getStringExtra("SCAN_RESULT");
                 String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
                 // Handle successful scan
              } else if (resultCode == RESULT_CANCELED) {
                 // Handle cancel
              }
           }
        }                  
          }

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >


<RelativeLayout
    android:id="@+id/relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >



    <Button
        android:id="@+id/button1"
        android:layout_width="150dp"
        android:layout_height="60dp"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Scan qr code" />

</RelativeLayout>

</LinearLayout>

ActivityMainfest.xml

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.scan.qr"
 android:versionCode="1"
 android:versionName="1.0" >

<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.CAMERA"/>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".ScanActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="com.google.zxing.client.android.CaptureActivity"
    android:screenOrientation="landscape"
    android:configChanges="orientation|keyboardHidden"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:windowSoftInputMode="stateAlwaysHidden">
    <intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
       <intent-filter>
       <action android:name="com.google.zxing.client.android.SCAN"/>
       <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
    </activity>

    </application>

    </manifest>

I have also added a folder “zcore” containing core.jar file in my project named “scan” and have added it in the properties i.e under “JavaBuildPath” added jar file named “core.jar” located in “zcore” folder of my project.

Now i tried to run this on emulator it gives me error message like these:

AndroidRuntime(401): at     
com.google.zxing.client.android.camera.CameraManager.getFramingRectInPreview   
(CameraManager.java:218)

AndroidRuntime(401): at  
com.google.zxing.client.android.ViewfinderView.onDraw(ViewfinderView.java:117) 

AndroidRuntime(401): at   
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)

dalvikvm(401): Unable to open stack trace file '/data/anr/traces.txt': Permission 
denied

and then I tried to run the apk file on my samsung galaxy y phone, it runs fine and when I click the button “scan qr code” it opens the camera and when I put image of qr code in front of camera it detects the qr code and reads it and says “Found URL” and then the main page opens up again and it does not redirects me to the specific URL. How can I figure how it will redirect me and show me the information of the qt code? Why doesn’t it redirect me to the URL and why does it open the main page again after scanning a qr code?

Please help me out how to solve this problem! Is their anything wrong I did or is there anything to do while making an qr code reader and also please suggest me how to add filters in the qr code reader.

  • 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-30T13:25:28+00:00Added an answer on May 30, 2026 at 1:25 pm

    You have no code to launch the URL. The clue is here:

    if (resultCode == RESULT_OK) {
        String contents = intent.getStringExtra("SCAN_RESULT");
        String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
        // Handle successful scan
    

    You need to replace the Handle successful scan reminder with some code to actually handle the scanned URL. For an example of how to launch a URL, see How can I open a URL in Android's web browser from my application?

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

Sidebar

Related Questions

I'm creating a code that gets image's urls from any web pages, the code
Can I avoid third party code from creating new threads, starting new VMs, or
I have added canvas in the xaml file. From code iam creating two rectangles
I'm creating a small code plugin which allows you to do some things with
I have the following code for creating tabs. It works at the end of
I have this webdav code thats creating folders in SharePoint: HttpWebRequest request = (System.Net.HttpWebRequest)HttpWebRequest.Create(folderAddress);
What would be the code for creating a table with two foreign keys? I
Eariler I happily used the following code for creating form elements (inside Zend_Form descendant):
I asked a similar question a while ago Error Creating Debug Information - Code
If I check out a tagged version of my source code without creating a

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.