Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] java – In Android Using Zxing scanner how to read UPI QR code?

Posted on November 11, 2022 By

Solution 1 :

Zxing’s result.text gets you a string of the content of the QR Code. you could create a function to get the value that you want.

val trxnRefId = result.text.substringAfter(&tr=).substringBefore(&tn=)

Problem :

Using the Zxing library I am generating QR Code for UPI transactions.
Below is the string

 String UPI = "upi://pay?pa=" + payeeAddress + "&pn=" + payeeName
            + "&tr=" + trxnRefId
            + "&tn=" + trxnNote + "&am=" + payeeAmount + "&cu=" + currencyCode+ "&ad="+ str ;

Using Zxing Scanner, how to read values one by one like transaction reference id, amount and payee name.

Present I am getting a full string of UPI using the below code.

 @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);

      Toast.makeText(this, "Scanned: " + result.getContents(), 
                     Toast.LENGTH_LONG).show();
}

Comments

Comment posted by Niranjan Reddy

I can not able to get text object and substringAfter method

Comment posted by Mateo Hervas

That is because of the onActivityResult. First get your result.getContents and check what content do you have on it. you should have the result of the scan by zxing as a string. then you can do the

READ  [FIXED] android - FrameLayout.getId() on a null object
Powered by Inline Related Posts
Android Tags:android, android-mediascanner, java, upi

Post navigation

Previous Post: [FIXED] java – The Android LoaderManager is deprecated. Now what?
Next Post: [FIXED] android – Is WorkManager the right solution for me?

Related Posts

[FIXED] java – Android Studio: setOnDateChangeListener not working Android
[FIXED] Unexpected behaviour of MediaPlayer Android Android
[FIXED] How to see XML files code in Android Studio 3.6.1 Android
[FIXED] android – flutter back button to Column visibility Android
[FIXED] java – How to remove previous selected item from autocompletetextview Android
[FIXED] android – Function behaving abnormally Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What are the main features of Islamic education?
  • Is the Jeep 4xe worth it?
  • How does the ringer work on cast iron?
  • What is the biggest size interior door?
  • Is blue raspberry an original Jolly Rancher flavor?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme