|
|
|
Android รูปภาพไม่แสดงครับ ต้องแก้ไขยังไงบ้าง รบกวนหน่อยนะครับ |
|
|
|
|
|
|
|
นี่คือ Code ครับ
Code (Android-Java)
// Paste Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("txtKeyword", inputText.getText().toString()));
try {
JSONArray data = new JSONArray(getJSONUrl(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("TempleID", c.getString("TempleID"));
map.put("Name", c.getString("Name"));
map.put("Address", c.getString("Address"));
map.put("Lattitude", c.getString("Lattitude"));
map.put("Longtitude", c.getString("Longtitude"));
map.put("Image", c.getString("Image"));
MyArrList.add(map);
}
SimpleAdapter sAdap;
sAdap = new SimpleAdapter(SearchTemple.this, MyArrList, R.layout.column_temple,new String[] {"TempleID", "Name","Address"}, new int[] {R.id.ColID, R.id.ColName,R.id.colAdd});
lisView1.setAdapter(sAdap);
final AlertDialog.Builder viewDetail = new AlertDialog.Builder(this);
// OnClick Item
lisView1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> myAdapter, View myView,int position, long mylng) {
String strTempleID = MyArrList.get(position).get("TempleID").toString();
String strName = MyArrList.get(position).get("Name").toString();
String strAddress = MyArrList.get(position).get("Address").toString();
String strLattitude = MyArrList.get(position).get("Lattitude").toString();
String strLongtitude = MyArrList.get(position).get("Longtitude").toString();
String strImage = MyArrList.get(position).get("Image").toString();
viewDetail.setIcon(android.R.drawable.btn_star_big_on);
viewDetail.setTitle("Temple Detail");
viewDetail.setMessage("TempleID : " + strTempleID + "\n"
+ "Name : " + strName + "\n"
+ "Address : " + strAddress + "\n"
+ "Lattitude : " + strLattitude + "\n"
+ "Longtitude : " + strLongtitude+ "\n"
+ "Image : " + strImage);
viewDetail.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
viewDetail.show();
}
});
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Tag : Mobile, MySQL, Android
|
|
|
|
|
|
Date :
2013-11-08 12:48:19 |
By :
phuwadonlove |
View :
967 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รูปภาพก็จะต้องใช้ ImageView แสดงครับ ไม่ใช่ Label หาอ่านได้ในบทความครับ มีเยอะแยะ
|
|
|
|
|
Date :
2013-11-08 13:08:49 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้ายังงั้นผมก็ต้องสร้างไฟล์ xml ขึ้นอีกหรือป่าวครับ
ผมไม่ค่อยรู้เรื่องเลย
|
|
|
|
|
Date :
2013-11-08 14:11:17 |
By :
phuwadonlove |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|