|
![](/images/resource/spacer.gif) |
|
Android - สอบถามเรื่อง QR Code สแกนเสร็จแล้วเก็บข้อมูลที่สแกนลงใน SQLite และแบ่งเป็นฟิวๆในฐานข้อมูลหน่อยครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ตัว QR Code มันส่งมาเป็นแบบไหนครับ ใช้พวก ตัด แบ่ง อะไร ก็ว่าไป
Code (Android-Java)
ContentValues Val = new ContentValues();
Val.put("MemberID", strMemberID);
Val.put("Name", strName);
Val.put("Tel", strTel);
long rows = db.insert(TABLE_MEMBER, null, Val);
Android Add Insert Data to SQLite Database (Android SQLite)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2014-11-27 09:46:49 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
CODE ที่ผมทำเป็นแบบนี้อะครับ แนะนำหน่อยครับ จะแบ่งยังไง
![การcsan การcsan](https://www.thaicreate.com/upload/stock/20141127101634.png?v=1001)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2014-11-27 10:18:27 |
By :
fawins |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ส่วนในการ scanเสร็จ ผมก็ทำไปไว้ที่ Edittext แล้วก็มาแปลงให้เป็น String แล้วถึงไปเก็บค่า ในSQLite ตอนแรกผมใช้ TextViewแต่มันไปเก็บค่าเป็นอะไรไม่รุอะครับ ไม่ได้เก็บที่สแกรนมา
อย่างในรูปผมควรที่จะ ตัด แบ่ง ในEdittext เวลาสแกนยังไงครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2014-11-27 10:24:38 |
By :
fawins |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ค่าที่สแกนมาเป็นรูปแบบประมาณไหนละครับ จะได้ช่วยดูได้
บรรทัด 49 ที่เขียนคอมเม้นไว้ EditText จริงๆมัน TextView นี่ครับ
บรรทัด 72 ทำไมต้องใช้เงื่อนไขเดียวกัน ซ้ำๆ เดาว่าอยากใช้เป็น text[0], text[1], text[2] ที่ตัดค่าจากสแกนแล้ว ประมาณนี้หรือเปล่า
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2014-11-27 12:16:06 |
By :
devahoy |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ใช้ String.split() ก็ได้แล้วครับ ดููตัวที่ซ้ำกัน ในที่นี้คือ "/ " ก็แบ่งกลุ่มมันใส่ array ตามนี้
Code (Java)
String sample = "CS.1/ 5407024/ นายกไก่/ ขไข่";
String[] inputs = sample.split("/ ");
for(String input : inputs) {
System.out.println(input);
}
อ้างอิง Java String#split
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2014-11-27 19:02:21 |
By :
devahoy |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 00
|