SlideShare a Scribd company logo
ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ
1
ພາກປະຕິບັດ 11
QR Code and Barcode
1. ສ້າງໂປຣເຈັກໂດຍຕັ້ງຊື່ວື່າ: QRCode And Barcode
2. ນາເອົາ Button ມາໃສື່ໃນ activity_main.xml ແລະການ ົດ ID ໃຫ້ເປັນຄື່າ btScan ດັື່ງຮູບ
3. ເພີື່ ມ Empty Activity ໃໝື່ ໂດຍຕັ້ງຊື່ວື່າ ScanningActivity
4. ນາເອົາ Library ນີ້ເຂົ້າມາໃຊ້
implementation 'me.dm7.barcodescanner:zbar:1.9.8'
5. ເພີື່ ມໂຄດນີ້ໃສື່ AndroidMinifest.xml
<uses-permission android:name="android.permission.CAMERA" />
6. ຂຽນໂຄດໃສື່ MainActivity.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
if (ActivityCompat.checkSelfPermission(this, android
.Manifest.permission.CAMERA) != PackageManager
.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, arrayOf(
ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ
2
android.Manifest.permission.CAMERA), 0)
}
btScan.setOnClickListener {
val intent=Intent(this,ScanningActivity::class.java)
startActivity(intent)
}
}
7. ຂຽນໂຄດໃສື່ ScanningActivity.kt
class ScanningActivity : AppCompatActivity(),
ZBarScannerView.ResultHandler {
private lateinit var mScannerView: ZBarScannerView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mScannerView = ZBarScannerView(this)
setContentView(mScannerView)
}
override fun onResume() {
super.onResume()
mScannerView.setResultHandler(this)
mScannerView.startCamera()
}
override fun onPause() {
super.onPause()
mScannerView.stopCamera()
}
override fun handleResult(result: Result?) {
Toast.makeText(this, result?.contents, Toast
.LENGTH_SHORT).show()
mScannerView.resumeCameraPreview(this)
}
}//Main Class
ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ
3
8. ທົດສອບ app
====================
ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ
4
ຝກຫັດ
ຈ ົື່ງຂຽນໂຄດເມື່ອສະແກນແລ້ວໃຫ້ນາລະຫັດມາສະແດງໃນ TextView ທີື່ ຢູື່ activity_main ດັື່ງຮູບ
====================

More Related Content

More from Phonepaseuth Phonhdala

Lab 2 time picker dialog
Lab 2 time picker dialogLab 2 time picker dialog
Lab 2 time picker dialog
Phonepaseuth Phonhdala
 
ການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນ
ການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນ
ການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນ
Phonepaseuth Phonhdala
 
ການກະກຽມຂໍ້ມູນ (Prepare data)
ການກະກຽມຂໍ້ມູນ (Prepare data)ການກະກຽມຂໍ້ມູນ (Prepare data)
ການກະກຽມຂໍ້ມູນ (Prepare data)
Phonepaseuth Phonhdala
 
ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ
ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ
ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ
Phonepaseuth Phonhdala
 
ພາກປະຕິບັດ 8 (Lab 8)
ພາກປະຕິບັດ 8 (Lab 8)ພາກປະຕິບັດ 8 (Lab 8)
ພາກປະຕິບັດ 8 (Lab 8)
Phonepaseuth Phonhdala
 
ພາກປະຕິບັດ 7 (Lab 7)
ພາກປະຕິບັດ 7 (Lab 7)ພາກປະຕິບັດ 7 (Lab 7)
ພາກປະຕິບັດ 7 (Lab 7)
Phonepaseuth Phonhdala
 
ພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBox
ພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBoxພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBox
ພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBox
Phonepaseuth Phonhdala
 
ພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButton
ພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButtonພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButton
ພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButton
Phonepaseuth Phonhdala
 
Chapter2
Chapter2Chapter2
Chapter1
Chapter1Chapter1
ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່
ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່
ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່
Phonepaseuth Phonhdala
 
ຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipse
ຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipseຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipse
ຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipse
Phonepaseuth Phonhdala
 
ບົດທີ 7 ການຈັດການຖານຂໍ້ມູນ
ບົດທີ 7 ການຈັດການຖານຂໍ້ມູນບົດທີ 7 ການຈັດການຖານຂໍ້ມູນ
ບົດທີ 7 ການຈັດການຖານຂໍ້ມູນ
Phonepaseuth Phonhdala
 
ບົດທີ 6 Client/Server
ບົດທີ 6 Client/Serverບົດທີ 6 Client/Server
ບົດທີ 6 Client/Server
Phonepaseuth Phonhdala
 
ບົດທີ 5 Condition and Loop
ບົດທີ 5 Condition and Loopບົດທີ 5 Condition and Loop
ບົດທີ 5 Condition and Loop
Phonepaseuth Phonhdala
 
ບົດທີ 4 String Method
ບົດທີ 4 String Methodບົດທີ 4 String Method
ບົດທີ 4 String Method
Phonepaseuth Phonhdala
 
ບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSP
ບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSPບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSP
ບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSP
Phonepaseuth Phonhdala
 
ບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSP
ບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSPບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSP
ບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSP
Phonepaseuth Phonhdala
 
ບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSP
ບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSPບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSP
ບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSP
Phonepaseuth Phonhdala
 
ບົດທີ 2 ສາຍສັນຍານ ແລະ Wireless
ບົດທີ 2 ສາຍສັນຍານ ແລະ Wirelessບົດທີ 2 ສາຍສັນຍານ ແລະ Wireless
ບົດທີ 2 ສາຍສັນຍານ ແລະ Wireless
Phonepaseuth Phonhdala
 

More from Phonepaseuth Phonhdala (20)

Lab 2 time picker dialog
Lab 2 time picker dialogLab 2 time picker dialog
Lab 2 time picker dialog
 
ການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນ
ການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນ
ການເພີ່ມ, ແກ້ໄຂ, ລຶບ ຂໍ້ມູນ
 
ການກະກຽມຂໍ້ມູນ (Prepare data)
ການກະກຽມຂໍ້ມູນ (Prepare data)ການກະກຽມຂໍ້ມູນ (Prepare data)
ການກະກຽມຂໍ້ມູນ (Prepare data)
 
ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ
ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ
ພາກປະຕິບັດ 9 (Lab 9) ຈັດການຖານຂໍ້ມູນ
 
ພາກປະຕິບັດ 8 (Lab 8)
ພາກປະຕິບັດ 8 (Lab 8)ພາກປະຕິບັດ 8 (Lab 8)
ພາກປະຕິບັດ 8 (Lab 8)
 
ພາກປະຕິບັດ 7 (Lab 7)
ພາກປະຕິບັດ 7 (Lab 7)ພາກປະຕິບັດ 7 (Lab 7)
ພາກປະຕິບັດ 7 (Lab 7)
 
ພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBox
ພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBoxພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBox
ພາກປະຕິບັດ 6 (Lab 6) ການໃຊ້ CheckBox
 
ພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButton
ພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButtonພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButton
ພາກປະຕິບັດ 5 (Lab 5) ການນຳໃຊ້ RadioButton
 
Chapter2
Chapter2Chapter2
Chapter2
 
Chapter1
Chapter1Chapter1
Chapter1
 
ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່
ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່
ພາກປະຕິບັດ 4 (Lab 4) ການເປິດActivity ໃໝ່
 
ຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipse
ຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipseຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipse
ຕິດຕັ້ງ Tomcat (xampp) ໃນ eclipse
 
ບົດທີ 7 ການຈັດການຖານຂໍ້ມູນ
ບົດທີ 7 ການຈັດການຖານຂໍ້ມູນບົດທີ 7 ການຈັດການຖານຂໍ້ມູນ
ບົດທີ 7 ການຈັດການຖານຂໍ້ມູນ
 
ບົດທີ 6 Client/Server
ບົດທີ 6 Client/Serverບົດທີ 6 Client/Server
ບົດທີ 6 Client/Server
 
ບົດທີ 5 Condition and Loop
ບົດທີ 5 Condition and Loopບົດທີ 5 Condition and Loop
ບົດທີ 5 Condition and Loop
 
ບົດທີ 4 String Method
ບົດທີ 4 String Methodບົດທີ 4 String Method
ບົດທີ 4 String Method
 
ບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSP
ບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSPບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSP
ບົດທີ 3 ເລີ່ມຕົ້ນຂຽນ JSP
 
ບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSP
ບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSPບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSP
ບົດທີ 1 ຄວາມຮູ້ພື້ນຖານກ່ຽວກັບ JSP
 
ບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSP
ບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSPບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSP
ບົດທີ 2 ກຽມເຄື່ອງມືສຳລັບຂຽນ JSP
 
ບົດທີ 2 ສາຍສັນຍານ ແລະ Wireless
ບົດທີ 2 ສາຍສັນຍານ ແລະ Wirelessບົດທີ 2 ສາຍສັນຍານ ແລະ Wireless
ບົດທີ 2 ສາຍສັນຍານ ແລະ Wireless
 

Lab 11 qr and bar code

  • 1. ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ 1 ພາກປະຕິບັດ 11 QR Code and Barcode 1. ສ້າງໂປຣເຈັກໂດຍຕັ້ງຊື່ວື່າ: QRCode And Barcode 2. ນາເອົາ Button ມາໃສື່ໃນ activity_main.xml ແລະການ ົດ ID ໃຫ້ເປັນຄື່າ btScan ດັື່ງຮູບ 3. ເພີື່ ມ Empty Activity ໃໝື່ ໂດຍຕັ້ງຊື່ວື່າ ScanningActivity 4. ນາເອົາ Library ນີ້ເຂົ້າມາໃຊ້ implementation 'me.dm7.barcodescanner:zbar:1.9.8' 5. ເພີື່ ມໂຄດນີ້ໃສື່ AndroidMinifest.xml <uses-permission android:name="android.permission.CAMERA" /> 6. ຂຽນໂຄດໃສື່ MainActivity.kt override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) if (ActivityCompat.checkSelfPermission(this, android .Manifest.permission.CAMERA) != PackageManager .PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, arrayOf(
  • 2. ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ 2 android.Manifest.permission.CAMERA), 0) } btScan.setOnClickListener { val intent=Intent(this,ScanningActivity::class.java) startActivity(intent) } } 7. ຂຽນໂຄດໃສື່ ScanningActivity.kt class ScanningActivity : AppCompatActivity(), ZBarScannerView.ResultHandler { private lateinit var mScannerView: ZBarScannerView override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) mScannerView = ZBarScannerView(this) setContentView(mScannerView) } override fun onResume() { super.onResume() mScannerView.setResultHandler(this) mScannerView.startCamera() } override fun onPause() { super.onPause() mScannerView.stopCamera() } override fun handleResult(result: Result?) { Toast.makeText(this, result?.contents, Toast .LENGTH_SHORT).show() mScannerView.resumeCameraPreview(this) } }//Main Class
  • 3. ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ 3 8. ທົດສອບ app ====================
  • 4. ວິທະຍາໄລສອນພິທັກລາວ ອຈ ພອນປະເສີດ ຜົນດາລາ 4 ຝກຫັດ ຈ ົື່ງຂຽນໂຄດເມື່ອສະແກນແລ້ວໃຫ້ນາລະຫັດມາສະແດງໃນ TextView ທີື່ ຢູື່ activity_main ດັື່ງຮູບ ====================