Android Video Upload without wait for Response -


i have created video upload activity asynctask function. tried send request sever upload video , server take more time upload , return response . there anyway send response server without wait server response ? need send request server, no need wait repsonse , transfer other page's .

kindly explain how .

thanks advance.

public class uploadactivity extends appcompatactivity {

private string videourl; private textview statusview; progressdialog uploading; private string questionid; private final int splash_display_length = 4500;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_upload);     if (android.os.build.version.sdk_int > 9) {         strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build();         strictmode.setthreadpolicy(policy);     }        statusview = (textview)findviewbyid(r.id.uploadstatus);     bundle extras = getintent().getextras();     if (extras != null) {         if (extras.containskey("path")) {             videourl = extras.getstring("path");             questionid = string.valueof(extras.getint("questionid"));         }       }     uploading = progressdialog.show(uploadactivity.this, "uploading file", "please wait...", false, false);     new handler().postdelayed(new runnable() {         @override         public void run() {              uploadvideo();          }     }, splash_display_length); } private void uploadvideo() {     class uploadvideo extends asynctask<void, void, string> {           @override         protected void onpreexecute() {             super.onpreexecute();          }          @override         protected void onpostexecute(string s) {             super.onpostexecute(s);             uploading.dismiss();               log.i("video response", s.tostring());             try {                 jsonobject jsonobject = new jsonobject(s);                 if(jsonobject.has("validation")){                      if(jsonobject.getstring("validation") == "true" ){                         toast.maketext(getapplicationcontext(),"video created successfully",toast.length_long).show();                     }else{                         toast.maketext(getapplicationcontext(),"video not created ",toast.length_long).show();                     }                     intent in = new intent(getapplicationcontext(), viewquestions.class);                     //  intent in = new intent(getapplicationcontext(), drawingactivity.class);                     in.putextra("questionid", questionid);                     finish();                     startactivity(in);                 }             } catch (jsonexception e) {                 e.printstacktrace();             }           }          @override         protected string doinbackground(void... params) {             upload u = new upload();             string msg = u.uploadvideo(videourl,questionid,uploadactivity.this);             return msg;         }     }     uploadvideo uv = new uploadvideo();     uv.execute(); } 

}

please check , let me know changes. thank .


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -