开发者

Regarding using android ksoap2 web servies

am trying do one example in androi开发者_开发知识库d ksoap2 web services.i tried one example in below url

http://naveenbalani.com/index.php/2011/01/invoke-webservices-from-android/

now am getting java.net.sockettimeoutexception connection timed out in my logcat

can anyone please help in resolving this issue.


Why you don't use Android AsyncTask? http://developer.android.com/reference/android/os/AsyncTask.html

For example:

  public class MyPreloader extends AsyncTask<InputObject, Void, OutputObject>{
 private Context context;
private ProgressDialog dialog;

public MyPreloader(Context context){
   this.context = context;
       }

           @Override
           protected void onPreExecute() {
       dialog = new ProgressDialog(context);
         dialog.setMessage("Please wait...");
      dialog.setIndeterminate(true);
         dialog.show();
      super.onPreExecute();
       }   

       @Override
      protected ResponseBase doInBackground(InputObject... params) {
      InputObject input = params[0]; 
    //some code for background work
           }

        @Override
         protected void onPostExecute(OutputObject result) {
            if (dialog.isShowing()) {
             dialog.dismiss();
           }
         super.onPostExecute(result);
         }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜