Async Task progress bar in for loop

tea_junkie

New Member
I have tried to hit web service using Async Task method.Here the for loop will dismiss the progress dialog from the first and crashes the Application. Kindly check this code and give suggestions.Sample Code........\[code\]for(Pageview pg:views){ value1=url1+"userid="+pg.getuserid()+"&chapterid="+pg.getchapterid()+"&pageno="+pg.getpageno()+"&view%20time="+pg.getviewtime()+"&IMEI%20no="+pg.getimeino()+"&feedback="+pg.getfeedback()+"&Comments="+pg.getcomments();//Toast.makeText(getApplicationContext(), value1, Toast.LENGTH_LONG).show(); System.out.println(value1);// feedbackdata feedback1=new feedbackdata(); feedbak.execute(value1); feedbackdata.loadingProgress = GUIStaticMethod.returnProgressBar(getApplicationContext()); //myLoginDataFatcher.start();GUIStaticMethod.mProgressDialog.setOnDismissListener(new OnDismissListener() { public void onDismiss(DialogInterface dialog) { if(res1.contains("Page View Insertion Successfully")==true) { Toast.makeText(getApplicationContext(), res1, Toast.LENGTH_LONG).show(); } else if(res1.contains("Page View Insertion Failed")==true) { } } });\[/code\]ERROR\[code\]04-02 10:52:34.956: E/AndroidRuntime(234): Uncaught handler: thread main exiting due to uncaught exception04-02 10:52:34.976: E/AndroidRuntime(234): java.lang.IllegalStateException: Cannot execute task: the task has already been executed (a task can be executed only once)04-02 10:52:34.976: E/AndroidRuntime(234): at android.os.AsyncTask.execute(AsyncTask.java:383)04-02 10:52:34.976: E/AndroidRuntime(234): at com.example.wireframe.webviewurl$11.onDismiss(webviewurl.java:1751)04-02 10:52:34.976: E/AndroidRuntime(234): at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1058)04-02 10:52:34.976: E/AndroidRuntime(234): at android.os.Handler.dispatchMessage(Handler.java:99)04-02 10:52:34.976: E/AndroidRuntime(234): at android.os.Looper.loop(Looper.java:123)04-02 10:52:34.976: E/AndroidRuntime(234): at android.app.ActivityThread.main(ActivityThread.java:4363)04-02 10:52:34.976: E/AndroidRuntime(234): at java.lang.reflect.Method.invokeNative(Native Method)04-02 10:52:34.976: E/AndroidRuntime(234): at java.lang.reflect.Method.invoke(Method.java:521)04-02 10:52:34.976: E/AndroidRuntime(234): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)04-02 10:52:34.976: E/AndroidRuntime(234): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)04-02 10:52:34.976: E/AndroidRuntime(234): at dalvik.system.NativeStart.main(Native Method)\[/code\]
 
Back
Top