//verifikasi //verifikasi Tutorial Reskin QR code and Barcode scanner and generator for Android with AdMob - Berita Pendapat.id
Skip to content Skip to sidebar Skip to footer

Tutorial Reskin QR code and Barcode scanner and generator for Android with AdMob

Tutorial Reskin QR code and Barcode scanner and generator for Android with AdMob
Table of Contents
A.   Project Structure
B.   Packages and Java Files
C.   XML Files
D.   Customization
E.  Credits

A)   Project Structure - top We made the project as simple as possible for better understanding. It contains few JAVA and XML file to customize. If you are new in Android Studio follow the instruction bellow to open the project:

B) Packages and JAVA Files - top

Project contains 5 different packages and every package contains multiple file in an organized way:

Packages and Classes:

Activity: Contains all activities




Adapter: Recycler view and viewpageres adapters are tighten up into this package



Data: This package contain two different sub package for different type of data management. Constants and Shared Preference has been organized under this package.





Fragment: Three major fragment has been kept under this package. All implementation of major features has been implemented into those fragments.



Utility: Multi purpose utility classes i.e: AdMob, Activity management utils, application utility, QR | Barcode generator wrapper and Image saver task has been implemented into different classes into the package.





Major features and relevant JAVA files:

Implemented in

This is the first fragment of three Tab. All code related to

scanning and camera toggling has been implemented here.
Scan QR | Barcode
activateScanner() is the method to activate QR and Barcode
scanner engine. zXingScannerView holds all the property of

ZXingScannerView which works everything of QR and Barcode


Code relevant to QR and Barocde generation has been

implemented here. Main view contains an input field with toggle

button, an image view and two fab button to save and share.

generateCode() is the method responsible to generate both QR
Generate QR |
and Barcode. It works with another class named CodeGenerator.
and CodeGenerator.java
CodeGenerator.java is a public class of utility package as
mentioned above. This class works with two different method

createQRCode() and createBarcode() which takes text input

generates QR or Barcode. User has to pass a input through

generateQRFor(String input) and generateBarFor(String input) ,

those also defines type of expected output too.

Core functionality of Save and Share has been implemented

into SaveImage.java class. This is actually an AsyncTask which

saveAndShare() method of
mainly create a backup of generated image bitmap to specific
Save and Share
directory of SD card. This class has been instantiated from
class and SaveImage.java
saveAndShare() method with image name and bitmap image. It

returns saved image URL through SaveListener listener. Once

image saved to SD card it will either be invoked shared intent or

show a text to notify user about saving.

All results has been saved into Shared Preference as comma

separated strings. On delivery result through setResultHandler()

setResultHandler() method
method, it saved to local shared preference as an appended
of ScanFragment.java class
string with previously saved strings. Shared preference
and HistoryFragment.java
functionality has been implemented into AppPreference.java


Result has been fetched into HistoryFragment.java class as an

C) XML Files - top

This project contains eight XML files for different views

1.   activity_main.xml: View implementation of MainActivity. It contains an Ad view, View Pager and Bottom Navigation drawer.
2.   activity_result.xml: Parent xml implementation of Result Activity.

3.   content_result.xml: A simple view with a fab button and text view to show result.

4.   activity_splash.xml: Implementation of initial splash page contain an image view and text view.

5.   fragment_generate.xml: Contains an input field, and image view, two fab button and a toggle button. Input field takes input to generate qr or barcode. Imageview shows output QR or Barcode. Two fab button has been used to Save and Share output. And the toggle button has been used as a switch to toggle output type (QR or Barcode).

6.   fragment_history.xml: Contains a Recycler View and a text view to show message if the list becomes empty.

7.   fragment_scan.xml: This fragment contains Frame Layout of main scanner and few other fab button to toggle camera settings.

8.   item_history.xml: List item of history page containing text view and a copy button.

E)   Customization - top

This project is fully customizable. You may want to customize source code in order to re-brand the app, add/modify feature and implement your own AdMob ID. Packages and Classes: section described functionality of each package, java file and relevant implementation, you can follow that section to customize code. Here is few other detailed instruction to customize few specific things what you may need before re-publish the app with your own branding

Re-brand app

Modify app name: Open app/src/main/res/values/strings.xml file and change the value of app_name

Modify app icon: Change app/src/main/res/drawable/ic_launcher.png file

Modify splash icon: Change app/src/main/res/drawable/ic_splash.png file

Modify Ad account

Currently we have integrated Admob with a demo account. You have to integrate your own Admob ID to earn money from your app. Go to https://www.google.com/admob/ and Sign Up for Admob with your Google account.

Follow instructions given in Admob dashboard, create project and get Ad IDs. Collect app ad id, banner ad unit id and interstitial ad unit id from AdMob. Modify app_ad_id, banner_ad_unit_id and interstitial_ad_unit_id values from app/src/main/res/values/strings.xml XML files with your values
Fullscreen Ad: Use this implementation to invoke fullscreen ad (also see image bellow):

AdManager.getInstance(mContext).loadFullScreenAd(mActivity); AdManager.getInstance(mContext).getInterstitialAd().setAdListener(new AdListener() {

public void onAdLoaded() {





Banner Ad: Use this implementation to show banner ad (also see image bellow):

XML Implementation:







app:adUnitId="@string/banner_ad_unit_id" />


AdManager.getInstance(mContext).showBannerAd((AdView) findViewById(R.id.adView));

Modify Ad Id:

Once again,thank you so much for purchasing this theme. As I said at the beginning, I'd beglad to help you if you have any questions relating to this theme. Noguarantees, but I'll do my best to assist. If you have a more general questionrelating to the themes on ThemeForest, you might consider visiting the forumsand asking your question in the "Item Discussion" section.

Post a Comment for "Tutorial Reskin QR code and Barcode scanner and generator for Android with AdMob"