multipartentity - How to print the sending data of multipart entity in android -


i have uploading multiple image , string data php server.i want print data want i'm sending sever.i have tried this

class imageuploadtask extends asynctask {

string sresponse = null;  @override protected void onpreexecute() {     // todo auto-generated method stub     super.onpreexecute();     dialog = progressdialog.show(room_addroom1.this, "uploading",             "please wait...", true);     dialog.show(); }    @override protected string doinbackground(string... params) {     try {          string url ="http://airbnb.abservetech.com/demo/public/mobile/hotel/roomsadd";         int = integer.parseint(params[0]);         system.out.println("i---"+i);           sharedpreferences prefs = getsharedpreferences(mypreferences, mode_private);         string userid = prefs.getstring("userid", null);          bitmap bitmap = decodefile(map.get(i));          httpclient httpclient = new defaulthttpclient();         httpcontext localcontext = new basichttpcontext();         httppost httppost = new httppost(url);         entity = new multipartentity();          bytearrayoutputstream bos = new bytearrayoutputstream();         bitmap.compress(bitmap.compressformat.jpeg, 100, bos);         byte[] data = bos.tobytearray();           byte[] res=bos.tobytearray();           entity.addpart("room_images", new bytearraybody(data,                 "image/jpeg", params[1]));           entity.addpart("user_id", new stringbody("52"));         entity.addpart("room_type",new stringbody( "premium"));         entity.addpart("room_prize", new stringbody("2356"));           httppost.setentity(entity);          bytearrayoutputstream bytes = new bytearrayoutputstream();          entity.writeto(bytes);         log.e("maintopost", "roommaintopost----" + entity.tostring());          httpresponse response = httpclient.execute(httppost,                 localcontext);         sresponse = entityutils.getcontentcharset(response.getentity());       } catch (exception e) {         if (dialog.isshowing())             dialog.dismiss();         log.e(e.getclass().getname(), e.getmessage(), e);      }     return sresponse; }  @override protected void onpostexecute(string sresponse) {     try {         if (dialog.isshowing())             dialog.dismiss();          if (sresponse != null) {             toast.maketext(getapplicationcontext(),                     sresponse + " photo uploaded successfully",                     toast.length_short).show();             count++;             if (count < map.size()) {                 new imageuploadtask().execute(count + "", "hm" + count                         + ".jpg");             }         }      } catch (exception e) {         toast.maketext(getapplicationcontext(), e.getmessage(),                 toast.length_long).show();         log.e(e.getclass().getname(), e.getmessage(), e);     }  } 

}

but output display this

e/maintopost: roommaintopost----org.apache.http.entity.mime.multipartentity@42f2d390 

how print sending values?

 string entitycontentasstring = new string(byteoutputstream.tobytearray());     log.e("multipartentitty:", "" + entitycontentasstring); 

try this.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -