鏈接的頁號我有具有以JSON如何改變在機器人
的響應的URLLON = -0.1275 & PG = 0
我解析從它的數據,並在顯示的ListView中,顯示20個視野後上述網址應改爲
LON = -0.1275 & PG = 1
即「PG」必須從0改變爲許多頁。怎麼做?
請給我提供一些幫助
在此先感謝
鏈接的頁號我有具有以JSON如何改變在機器人
的響應的URLLON = -0.1275 & PG = 0
我解析從它的數據,並在顯示的ListView中,顯示20個視野後上述網址應改爲
LON = -0.1275 & PG = 1
即「PG」必須從0改變爲許多頁。怎麼做?
請給我提供一些幫助
在此先感謝
你可以有一個類級別的變量
int page = 0;
當你讓喲烏爾網址只是追加像這樣:
url = "http://dentonsweb.com/app/html/android/get.php?what=Restaurants&lat=51.507222&lon=-0.1275&pg="+page;
,每次與你的分頁這樣增加它:
page+=10;
再做請求。
您可以使用字符串的更換方法來修改URL字符串:
String url = "http://dentonsweb.com/app/html/android/get.php?what=Restaurants&lat=51.507222&lon=-0.1275&pg=0";
url = url.replace("&pg=0", "&pg=1");
我想這種方式,沒有測試。
url = "http://dentonsweb.com/app/html/android/get.php?what=Restaurants&lat=51.507222&lon=-0.1275&pg=";
int i=0;
do{
tempURL = url+i;
// get tempURL response
if(response==null) break;
else
{
// parse response
i++;
}
}while(response!=null)