A QR Code is a two dimensional optical bar code which is used for carrying data. QR stands for "Quick Response". Each QR Code normally contains an identifier, a locator and a url. These codes were initially used for tracking of auto parts but have become more popular in recent years. Nowadays they are used for providing easy access to website as well as for tracking purposes. That has made them a key marketing tool.
Instead of typing a url, a user can simply scan a code and be redirected to a specific page on a website. You can however adapt the QR Code and use it as you wish. Some time back I mentioned a tracking app for employees or students... using a QRCODE and your listviews, you can create a powerful tracking app.
Use the logic below onbutton click. Set imageview fro url join the link and the textview that you will be using to enter your text. Then set the image visible when an image is displayed.
Instead of typing a url, a user can simply scan a code and be redirected to a specific page on a website. You can however adapt the QR Code and use it as you wish. Some time back I mentioned a tracking app for employees or students... using a QRCODE and your listviews, you can create a powerful tracking app.
So let's create a simple app which generates a QR Code using the data that we will provide.
How it will work
A user can type something in an edittext field and when they click a button, we will call the QR code using an API to generate a code. We will then display that code in an imageview. So this code will be carrying whatever we put in our edittext field. In the first image I sent... if you scan it using a scanner app, you will see the message "ndeipi wangu".
Creating the layout
All we need to do is add the following:
1. Edittext- this is where we will type what the QR Code should hold. *NB- you can use other means of getting the data. e.g. you could allocate a username and get the current time without the user typing a thing
2. A button- this is where we will place our logic to translate the words we type into a QR code.
3. Imageview- this will display our QRCode So it will look like this
https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=
The final app will look like this:
Comments