|
![](/images/resource/spacer.gif) |
|
Android studio เกี่ยวกับการค้นหาข้อมูลจาก mysql มาแสดงในรูปแบบ listview |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ผมจำไม่ได้ว่าเอาโค๊ดมาจากบทความไหน ตอนแรกผมทำจากอีกโปรเจคคือ new ขึ้นมาใหม่ พอ Run ผ่าน จะเอามาใส่โปรเจคใหญ่
พอผ่านแล้ว ได้แบบที่ต้องการแล้วเอามาใส่โปรเจคใหญ่ ขึ้น error ตามรูปครับ
![หฟก หฟก](https://www.thaicreate.com/upload/stock/20160501013049.png?v=1001)
มั่วไป มั่วมา ลองลบโค๊ดส่วนข้างล่างก็ออกก็ run ได้ แค่ไม่มีการแสดงผล
เกิดจากอะไร ขอคำแนะนำหน่อยครับ ขอบคุณครับ
Code (Android-Java)
@Override
protected Void doInBackground(String... arg) {
// TODO Auto-generated method stub
// keySearch
EditText strKeySearch = (EditText) findViewById(R.id.txtKeySearch);
/**
* [
* {"MemberID":"1","Username":"weerachai","Password":"weerachai@1","Name":"Weerachai Nukitram","Tel":"0819876107","Email":"[email protected]"},
* {"MemberID":"2","Username":"adisorn","Password":"adisorn@2","Name":"Adisorn Bunsong","Tel":"021978032","Email":"[email protected]"},
* {"MemberID":"3","Username":"surachai","Password":"surachai@3","Name":"Surachai Sirisart","Tel":"0876543210","Email":"[email protected]"}
* ]
*/
String url = "http://202.28.94.32/2558/ict7/searchData.php";
// Paste Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
try {
JSONArray data = new JSONArray(Connect.getHttpPost(url, params));
final ArrayList<HashMap<String, String>> MyArrList = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map;
for (int i = 0; i < data.length(); i++) {
JSONObject c = data.getJSONObject(i);
map = new HashMap<String, String>();
map.put("proID", c.getString("proID"));
map.put("proName", c.getString("proName"));
map.put("startpro", c.getString("startpro"));
map.put("endpro", c.getString("endpro"));
map.put("address", c.getString("address"));
map.put("imgpath", c.getString("imgpath"));
MyArrList.add(map);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
Tag : Mobile
![](/images/adv.jpg?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 :
2016-05-01 01:32:27 |
By :
nomzod |
View :
1251 |
Reply :
2 |
|
![](/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 (Android-Java)
defaultConfig {
multiDexEnabled true
}
|
![](/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 :
2016-05-01 18:21:47 |
By :
nomzod |
|
![](/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) |
|
![](/images/bbcode/grin.gif?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 :
2016-05-02 22:52:09 |
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/digitalocean-banner.jpg)
|
Load balance : Server 01
|