Skip to content

MoaazElneshawy/QrGeneratorWithLogo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

QrGeneratorWithLogo

Generate Qr Code using ZXING with a logo if needed

Download the Helper file and use it

1- add zxing lib into your project

  implementation 'com.google.zxing:core:3.4.0'

2- use the helper methods

     try {
		 val content = "www" // add your content here

		 try {
			 val displayMetrics = DisplayMetrics()
			 context.windowManager.defaultDisplay?.getMetrics(displayMetrics)

				val size = displayMetrics.widthPixels.coerceAtMost(displayMetrics.heightPixels)

				val overlay = context.getDrawableCompat(R.drawable.app_icon)
									?.toBitmap(100.dpToPx(), 100.dpToPx())

				val bitmap = content.encodeAsQrCodeBitmap(
							size,
							overlay,
							context.getColorCompat(R.color.hj_color_blue),
							context.getColorCompat(android.R.color.white)
						)
				bitmap?.let {imageView.setImageBitmap(it)} // replace imageView with your view
					
      } catch (e: Exception) {
						e.printStackTrace()
				}      

here's the link where I found this awesome solution https://stackoverflow.com/questions/54628972/how-to-generate-qr-code-with-image-overlay-in-gluon/59096327#59096327

About

Generate Qr Code using ZXING with a logo if needed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages