最贊回答 / InBin
一般做法是使用AsyncTask在后臺會開啟另外的線程,在重載的doInBackground()方法中打開服務(wù)器獲取json數(shù)據(jù)的url鏈接,然后獲取輸入流,然后再把輸入流轉(zhuǎn)換為String類型的數(shù)據(jù),在轉(zhuǎn)換為String類型的數(shù)據(jù)中可以使用JSONObject等類轉(zhuǎn)換,然后在重載的onPostExecute方法中會返回所有數(shù)據(jù),你可以在這里插入數(shù)據(jù)實(shí)體,這要看你怎么實(shí)現(xiàn)了。
2016-05-13
最新回答 / 慕神6627383
從百度開發(fā)向?qū)蠌?fù)制過來是這樣的
MyLocationData?data?=?new?MyLocationData.Builder()// ????????.direction(mCurrentX)// ????????.accuracy(location.getRadius())// ????????.latitude(location.getLatitude())// ??...
2016-04-25