舉例我點擊第一個item,我要進入另一個畫面,但另一個畫面的資料是這個item的詳細內容
請幫幫我~
public void stationListSetup() {
try {
List<Map<String, Object>> listMap = new ArrayList();
URL url = new URL(MmyContext.URLMYEATT);
// URL url = new URL(MYBICK);
conn = (HttpURLConnection) url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
conn.getInputStream()));
String line;
StringBuilder sb = new StringBuilder();
while ((line = in.readLine()) != null) {
sb.append(line);
}
JSONArray arr = new JSONArray(sb.toString());
for (int i = 0; i < arr.length(); i++) {
JSONObject obj = (JSONObject) arr.get(i);
Map<String, Object> map = new HashMap<String, Object>();
Double thxx = obj.optDouble("xx");
Double thyy = obj.optDouble("yy");
Double testxx = 121.51557;
Double testyy = 25.04655;
if ((Math.abs(lonnxx - thxx) + Math.abs(lonnyy - thyy)) < 0.03) {
map.put("txtName", obj.opt("name"));
map.put("txtRent", obj.opt("tel"));
map.put("txtPark", obj.opt("address"));
listMap.add(map);
}
}
ListView listView = (ListView) findViewById(R.id.listView1);
listView.setAdapter(new SimpleAdapter(this, listMap,
R.layout.listroe, new String[] { "txtName", "txtRent","txtPark"},
new int[] { R.id.store_name,R.id.store_phone, R.id.store_address }));
//添加點擊
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
startActivity(new Intent(ListhostActivity.this,StoreContent.class));
}
});
} catch (Exception e) {
Log.e("jsontolist", "", e);
}
}
請幫幫我~
public void stationListSetup() {
try {
List<Map<String, Object>> listMap = new ArrayList();
URL url = new URL(MmyContext.URLMYEATT);
// URL url = new URL(MYBICK);
conn = (HttpURLConnection) url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
conn.getInputStream()));
String line;
StringBuilder sb = new StringBuilder();
while ((line = in.readLine()) != null) {
sb.append(line);
}
JSONArray arr = new JSONArray(sb.toString());
for (int i = 0; i < arr.length(); i++) {
JSONObject obj = (JSONObject) arr.get(i);
Map<String, Object> map = new HashMap<String, Object>();
Double thxx = obj.optDouble("xx");
Double thyy = obj.optDouble("yy");
Double testxx = 121.51557;
Double testyy = 25.04655;
if ((Math.abs(lonnxx - thxx) + Math.abs(lonnyy - thyy)) < 0.03) {
map.put("txtName", obj.opt("name"));
map.put("txtRent", obj.opt("tel"));
map.put("txtPark", obj.opt("address"));
listMap.add(map);
}
}
ListView listView = (ListView) findViewById(R.id.listView1);
listView.setAdapter(new SimpleAdapter(this, listMap,
R.layout.listroe, new String[] { "txtName", "txtRent","txtPark"},
new int[] { R.id.store_name,R.id.store_phone, R.id.store_address }));
//添加點擊
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
startActivity(new Intent(ListhostActivity.this,StoreContent.class));
}
});
} catch (Exception e) {
Log.e("jsontolist", "", e);
}
}