Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class JSONTask extends AsyncTask<String, Void, JSONObject>{
- protected JSONObject doInBackground(String... params) {
- JSONObject json_data=null;
- try{
- HttpClient httpclient = new DefaultHttpClient();
- for(int i=0;i<counter;i++){
- Log.e("log_tag", myid.get(i));
- String s=myid.get(i);
- HttpPost httppost = new HttpPost("http://photogiuseppe.altervista.org/mydogs.php?id="+s);
- HttpResponse response = httpclient.execute(httppost);
- HttpEntity entity = response.getEntity();
- String body = EntityUtils.toString(entity);
- JSONObject result = new JSONArray(body).getJSONObject(0);
- is[i]=entity.getContent();
- }//fine ciclo for
- }//chiusura try
- catch(Exception e){
- Log.e("log_tag", "Errore in http connection"+e.toString());
- e.printStackTrace();
- }
- return json_data;
- }//chiusura doInBackground
- protected void postExecute(JSONObject json_data){}
- protected void onPostExecute(JSONObject json_data) {
- postExecute(json_data);
- }
- }//chiusura JSONTask
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement