@@ -48,12 +48,13 @@ Add the dependency
4848<chtgupta .qrutils.qrview.QRView
4949 android : id =" @+id/qrView"
5050 android : layout_width =" wrap_content"
51- android : layout_height =" wrap_content"
52- android : layout_gravity =" center"
53-
54- app : QR_size =" 96dp"
55- app : QR_data =" chtgupta.github.io"
56- app : QR_errorCorrectionLevel =" M"
51+ android : layout_height =" wrap_content"
52+ app : QR_data =" https://chtgupta.github.io"
53+
54+ // optional attributes
55+
56+ app : QR_size =" 96dp"
57+ app : QR_errorCorrectionLevel =" H"
5758 app : QR_foregroundColor =" @android:color/black"
5859 app : QR_backgroundColor =" @android:color/white" />
5960```
@@ -63,12 +64,13 @@ Add the dependency
6364``` java
6465
6566 QRView qrView = findViewById(R . id. qrView);
66-
67- qrView. setData(data)
68- .setSize(Integer . parseInt(size. getText(). toString()), (QRParams ) sizeSpinner. getSelectedItem())
69- .setErrorCorrectionLevel((ErrorCorrection ) errorCorrectionSpinner. getSelectedItem())
70- .setQRForegroundColor(foregroundColor)
71- .setQRBackgroundColor(backgroundColor)
67+
68+ qrView. setData(" https://chtgupta.github.io" ) // the only required method, rest all methods and listener are optional
69+
70+ .setSize(120 , QRParams . DP )
71+ .setErrorCorrectionLevel(ErrorCorrection . H )
72+ .setQRForegroundColor(Color . BLACK )
73+ .setQRBackgroundColor(Color . WHITE )
7274 .addListener(new QRViewListener () {
7375 @Override
7476 public void onQRInitiated () {
@@ -77,7 +79,7 @@ Add the dependency
7779
7880 @Override
7981 public void onQRGenerating () {
80- // fired when QR is generating
82+ // fired when QR is generating
8183 }
8284
8385 @Override
@@ -87,11 +89,10 @@ Add the dependency
8789
8890 @Override
8991 public void onError () {
90- // fired if an error is encountered while generating QR
92+ // fired if an error is encountered while generating QR
9193 }
9294 })
93- .build();
94-
95+ .build(); // always call build() after adding all methods and listener
9596```
9697
9798## Release History
0 commit comments