我目前正在制作社交媒体应用程序,我想获取所有Instagram图片供稿。我正在使用londatiga库,到目前为止我只收到10个feed,我想得到所有,我使用的代码是:
public class DownloadTask extends AsyncTask<URL, Integer, Long> {
protected void onCancelled() {
}
protected void onPreExecute() {
pDialog = new ProgressDialog(getActivity());
pDialog.setMessage("Getting Feeds...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
protected Long doInBackground(URL... urls) {
long result = 0;
try {
List<NameValuePair> params = new ArrayList<NameValuePair>(1);
params.add(new BasicNameValuePair("count", "10"));
InstagramRequest request = new InstagramRequest(
mInstagramSession.getAccessToken());
String response = request.createRequest("GET",
"/users/self/feed", params);
if (!response.equals("")) {
JSONObject jsonObj = (JSONObject) new JSONTokener(response)
.nextValue();
JSONArray jsonData = jsonObj.getJSONArray("data");
int length = jsonData.length();
flag_loading = false;
if (length > 0) {
for (int i = 0; i < length; i++) {
JSONObject jsonPhoto = jsonData.getJSONObject(i)
.getJSONObject("images")
.getJSONObject("low_resolution");
mPhotoList.add(jsonPhoto.getString("url"));
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
protected void onProgressUpdate(Integer... progress) {
}
protected void onPostExecute(Long result) {
pDialog.dismiss();
adapter.notifyDataSetChanged();
}
}
答案 0 :(得分:0)
for(i=0; i<arr.length; i++){
ar.push( (i+1)' ===== '+arr[i]+'<br>');
}
这就是我所做的,现在我在Listview滚动
上获得新的提要