我想從url獲取數據。在這種情況下,我已經得到了數據轉換成JSON已經在本地主機上運行完整的PHP(HTTP://localhost/adchara1/index.php/年= 1)從android中獲取數據url
這是PHP腳本
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$q=mysql_query("SELECT * FROM people
WHERE
birthyear>'".$_REQUEST['year']."'");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close(); ?>
,這是導致
[{"id":"1","name":"kongkea","sex":"1","birthyear":"1990"}, {"id":"2","name":"thida","sex":"0","birthyear":"2000"}]?>
我想用按一下按鈕,並顯示該結果的TextView
實際上你想問什麼?android代碼相同還是你有什麼疑問? –
在android中,我想從android中的textView中顯示結果的URL。 ex,在android中我有1button和1 TextView,我想要得到結果在URL'[{「id」:「1」,「name」:「kongkea」,「sex」:「1」,「birthyear」: 「1990」},{「id」:「2」,「name」:「thida」,「sex」:「0」,「birthyear」:「2000」}]?>'在TextView中顯示。 – kongkea