I am displaying a progress bar using Async task class and simulatneously in parallel operation , i want to retrieve a string array from a function of another class that takes some time to return the string array.
The problem is that when i place the function call in doing backgroung function of AsyncTask class , it gives an error in Doing Background and gives the message as cant change the UI in doing Background ..
Therefore , i placed the function call in post Execute method of Asynctask class . It doesnot give an error but after the progress bar has reached 100% , then the screen goes black and takes some time to start the new activity.
How can i display the progress bar and make the function call simultaneously.??plz help , m in distress
here is the code
package com.integrated.mpr;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Progess extends Activity implements OnClickListener{
static String[] display = new String[Choose.n];
Button bprogress;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.progress);
bprogress = (Button) findViewById(R.id.bProgress);
bprogress.setOnClickListener(this);
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.bProgress:
String x ="abc";
new loadSomeStuff().execute(x);
break;
}
}
public class loadSomeStuff extends AsyncTask<String , Integer , String>{
ProgressDialog dialog;
protected void onPreExecute(){
dialog = new ProgressDialog(Progess.this);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setMax(100);
dialog.show();
}
#Override
protected String doInBackground(String... arg0) {
// TODO Auto-generated method stub
for(int i = 0 ;i<40;i++){
publishProgress(5);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
dialog.dismiss();
String y ="abc";
return y;
}
protected void onProgressUpdate(Integer...progress){
dialog.incrementProgressBy(progress[0]);
}
protected void onPostExecute(String result){
display = new Logic().finaldata();
Intent openList = new Intent("com.integrated.mpr.SENSITIVELIST");
startActivity(openList);
}
}
}
You can't dismiss the dialog in doInBackground() - even dismissing a dialog needs the UI task. Move dialog.dismiss() to onPostExecute() of the AsyncTask.
Related
This is my MainActivity... i put one button, in button onclick i call asyncTask
package com.example.asnytaskpro;
import java.util.concurrent.ExecutionException;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class AsyncMainActivity extends Activity implements OnClickListener {
Button button ;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_async);
button = (Button) findViewById(R.id.button1);
button.setOnClickListener(this);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_async, menu);
return true;
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
System.err.println("1");
try {
new AllPrinterClass(AsyncMainActivity.this, "123456789123456789", "123").execute().get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
};
}
}
This is My AsyncTaskClass
import java.text.SimpleDateFormat;
import java.util.Calendar;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.os.SystemClock;
import android.widget.Toast;
public class AllPrinterClass extends AsyncTask<Integer, Integer, Integer>{
public static String ServerData = "";
private ProgressDialog prgDialog;
private Context context;
String TransNo = "" ,IMEINo = "";
int iRetValue = 0;
String CurrentDate = null, CurrentTime= null;
SimpleDateFormat df,tf;
public AllPrinterClass(Context context1, String imeiNo,String transno2)
{
this.context = context1;
this.IMEINo = imeiNo;
this.TransNo = transno2;
Calendar c = Calendar.getInstance();
df = new SimpleDateFormat("dd/M/yyyy");
CurrentDate = df.format(c.getTime());
tf = new SimpleDateFormat("hh:mm:ss");
CurrentTime = tf.format(c.getTime());
System.err.println(CurrentDate);
System.err.println(CurrentTime);
}
#Override
protected void onPreExecute() {
super.onPreExecute();
this.prgDialog = new ProgressDialog(context);
this.prgDialog.setMessage("Place your finger on FPS ...");
this.prgDialog.setIndeterminate(true);
this.prgDialog.setCancelable(false);
this.prgDialog.show();
}
#Override
protected Integer doInBackground(Integer... params) {
//////////////////Doing my Code///////////////////
for (int i = 0; i < 10; i++) {
System.err.println("i :-" + i);
SystemClock.sleep(500);
}
/////////////////////////////////////////////////////
return iRetValue;
}
#Override
protected void onPostExecute(Integer result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
prgDialog.dismiss();
Toast.makeText(context, "Done", Toast.LENGTH_SHORT).show();
}
}
This code working for me but my ProgressDialog not showing(May be run background).
In i remove prgDialog.dismiss(); in onPostExecute() Method then my dialog showing after doInBackground() Method.
I want dialog show in onPreExecute() Method and dismiss in onPostExecute() method.
Here:
...execute().get();
Calling get method will block main ui Thread until doInBackground execution not completed. that's why ProgressDialog is not showing.
Use only execute() method to start AsyncTask which show Progress Dialog during doInBackground method execution:
new AllPrinterClass(AsyncMainActivity.this,
"123456789123456789", "123").execute();
I am trying to login with username and password. If username is correct then goes to another Activity otherwise stay in current Activity.
If I am login the first time it works successfully but second time gives some error.
error.....
04-21 07:41:13.915: E/AndroidRuntime(2125): java.lang.IllegalStateException: Cannot execute task: the task has already been executed (a task can be executed only once)
04-21 07:41:13.915: E/AndroidRuntime(2125): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:578)
04-21 07:41:13.915: E/AndroidRuntime(2125): at android.os.AsyncTask.execute(AsyncTask.java:534)
04-21 07:41:13.915: E/AndroidRuntime(2125): at com.bis.storyanimationapp.LoginActivity$1.onClick(LoginActivity.java:35)
code:
LoginActivity
//enter code here
package com.bis.storyanimationapp;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import com.bis.storyanimationapp.asynchtask.AsynchTask1;
import com.bis.storyanimationapp.view.LoginView;
import com.example.storyanimationapp.R;
public class LoginActivity extends Activity {
LoginView loginView;
AsynchTask1 objLoginAsycTask;
#Override
protected void onCreate(Bundle savedInstanceState) {
loginView=new LoginView(this);
super.onCreate(savedInstanceState);
setContentView(loginView.getLayoutmain());
objLoginAsycTask=new AsynchTask1(LoginActivity.this,loginView);
loginView.getBtnLogin().setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
objLoginAsycTask.execute("");
//objLoginAsycTask.cancel(true);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.login, menu);
return true;
}
}
AsynchTask1
package com.bis.storyanimationapp.asynchtask;
import android.R.integer;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.widget.Toast;
import com.bis.storyanimationapp.LoginActivity;
import com.bis.storyanimationapp.MainActivity;
import com.bis.storyanimationapp.view.LoginView;
public class AsynchTask1 extends AsyncTask<String,integer, String> {
Activity activity;
Context context;
private ProgressDialog signUpProcess;
LoginView view;
// private AsyncInterface asyInter;
public AsynchTask1(Activity activity,LoginView view){
this.activity=activity;
this.view=view;
context=activity.getApplicationContext();
}
#Override
protected void onPreExecute() {
super.onPreExecute();
signUpProcess = ProgressDialog.show(this.activity, "Please Wait !!!",
"Submitting Data For Registration!!!", true, false);
Toast.makeText(context, "inpree ex.",10).show();
}
#Override
protected void onPostExecute(String result)
{
// TODO Auto-generated method stub
super.onPostExecute(result);
signUpProcess.dismiss();
Toast.makeText(context,"post",5).show();
myMethod(result);
}
private void myMethod(String result) {
// TODO Auto-generated method stub
if(view.getEdUserName().getText().toString().equals("abc")){
Intent i=new Intent(context,MainActivity.class);
activity.startActivity(i);
//this.activity.finish();
}else{
Toast.makeText(context,"invalid user name",5).show();
// Intent i=new Intent(context,LoginActivity.class);
// activity.startActivity(i);
//
}
}
#Override
protected String doInBackground(String... params) {
return view.getEdUserName().getText().toString();
//return null;
}
}
As #Raghunandan suggest , create a new instance of the asyntask every time:
public void onClick(View v) {
new AsynchTask1().execute("");
}
});
You try this codes :
loginView.getBtnLogin().setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
objLoginAsycTask=new AsynchTask1(LoginActivity.this,loginView);
objLoginAsycTask.execute((Void) null);
}
});
}
AsyncTask instances can only be used one time.
Instead, just call your task like new AsynchTask1().execute("");
From the AsyncTask API docs
Try to create a new instance of AsyncTask every time you log in.
#Override
public void onClick(View v) {
AsyncTask1 at = new AsyncTask1()
at.execute()
}
I'm simply loading an image on button click via url , i want progress bar to show downloadin done,0-100 now i had changed the code not showing the progress updation but only progress bar
kindly help. XML has a button [downloadbtn], and a progressbar, imageview and a quit button
mainfest.xml has acsess permission internet
code:
*
package com.example.t4;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import android.os.AsyncTask;
import android.os.AsyncTask.Status;
import android.os.Bundle;
import android.os.SystemClock;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
ProgressBar prgs;
ProgressTask task = new ProgressTask();
Button showProgressBtn;
Button stopProgressBtn;
ImageView img;
Bitmap bmp ;
TextView tv1;
int filesize,filedyn;
public void startdownload(){
try { URL url;
url = new URL("http://whywedoit.files.wordpress.com/2009/04/smile.jpg");
bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
URLConnection urlConnection = url.openConnection();
urlConnection.connect();
filesize = urlConnection.getContentLength();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv1=(TextView)findViewById(R.id.tv1);
img = (ImageView) findViewById(R.id.imageView1) ;
stopProgressBtn = (Button) findViewById(R.id.btnCancel);
prgs = (ProgressBar) findViewById(R.id.progress);
showProgressBtn = (Button) findViewById(R.id.btn);
prgs.setVisibility(View.INVISIBLE);
img.setVisibility(View.INVISIBLE);
tv1.setVisibility(View.INVISIBLE);
final ProgressTask pgt = new ProgressTask();
showProgressBtn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if(pgt.getStatus()==Status.RUNNING){Toast.makeText(getApplicationContext(), "Status"+pgt.getStatus(), Toast.LENGTH_SHORT).show();}
if(pgt.getStatus()==Status.FINISHED||pgt.getStatus()==Status.PENDING){
Toast.makeText(getApplicationContext(), "Status"+pgt.getStatus(), Toast.LENGTH_SHORT).show();
prgs.setVisibility(View.VISIBLE);
task.execute(10);
tv1.setVisibility(View.VISIBLE);
}}
});
stopProgressBtn.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
stopProgress();
}
});
}
private class ProgressTask extends AsyncTask<Integer,Integer,Void>{
protected void onPreExecute() {
super.onPreExecute();
prgs.setMax(100); // set maximum progress to 100.
}
protected void onCancelled() {
prgs.setMax(0); // stop the progress
Log.v("Progress","Cancelled");
finish();
}
protected Void doInBackground(Integer... params) {
startdownload();
//for(int j=0;j<=filesize;j++){
publishProgress((int) ((filedyn / (float) filesize) * 100));
//}
Log.v("Progress","Downloading");
return null;
}
protected void onProgressUpdate(Integer... values) {
prgs.setProgress(0);
Log.v("Progress","Updating");
}
protected void onPostExecute(Void result) {
img.setVisibility(View.VISIBLE);
tv1.setVisibility(View.INVISIBLE);
img.setImageBitmap(bmp);
prgs.setVisibility(View.INVISIBLE);
Log.v("Progress", "Finished");
}
}
public void stopProgress() {
task.cancel(true);
}
}
*
Sorry, I don't think you only have progress bar update problems. There are too many points needs to be repaired.
1st inside your OnClickListener, you are doing task.execute(10);showProgress(); AsnycTask is asynchronous task, you cannot put your showProgress() there. Do something with your code.
private boolean init = true;
private Void doInBackground(Integer... params) {
init = true;
startdownload();
Log.v("Progress", "Downloading");
return null;
}
protected void onProgressUpdate(Integer... values) {
if (init){
showProgress();
init = false;
}else{
prgs.setProgress(5);
Log.v("Progress", "Once");
}
}
2nd startdownload method, are you sure your startdownload method doing downloading? or just getting the length of filesize. Make it clear else you will get yourself confuse.
3nd To invoke onProgressUpdate, you need to call publishProgress(progressValue); Here's the sample.
private Void doInBackground(Integer... params) {
init = true;
startdownload();
publishProgress(5); // onProgressUpdate invoked
//
// doing download
//
Log.v("Progress", "Downloading");
return null;
}
use this code and use progressdialog instead of progressbar
#Override
protected void onProgressUpdate(Integer... progress) {
//Set the pertange done in the progress dialog
pd.setProgress((int) (progress[0]));
}
You need set the ProgressBar max value and you need to update the progress in onProgressUpdate
protected void onProgressUpdate(Integer... values) {
prgs.setProgress(values[0]);
Log.v("Progress","Once");
}
and call
publishProgress(progress)
in the doInBackground of ProgressTask to update the progress
Check for more ref
First of all, i have to state that i am new to Java in general & Android. I do however have the basics, or at least getting there.
The Purpose of my Application: At the company, we have a Remote server that we SSH to, and do some work. At some times, the server is unreachable and therefore disrupts our work.
My application is suppose to do the following:
1- Using Jsch, i SSH to the server, if there is a response, then, i will attempt again in 15 minutes, if there is no response, i want to notify.
i have successfully done the above in non android version of Java, and was able to do it in Android version, however on the main thread, thus i cannot update anything on the UI. In essence the Progress Bar..
In the regular version, the UI freezes, and in the AsyncTask version provided below. i get an exception as soon as i hit the button
Below is the code i am using, to be honest, i read all over that the best solution is AsyncTask, but since i am new to that, i am not sure were my wrong is. I honestly assume its may be in the AsyncTask and AsyncTask .
I am not sure what to use there...
Below is my code, hopefully someone can point out my mistake.
package com.example.myapp;
import java.io.IOException;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.HandlerThread;
import android.os.StrictMode;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;
import android.os.Handler;
public class VedasServerMonitorActivity extends Activity {
/** Called when the activity is first created. */
Button button;
EditText IP;
EditText UserName;
EditText Password;
EditText Port;
ProgressBar progressBar1;
String UserStr;
String PassStr;
String IPStr;
int PortInt;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button) findViewById(R.id.button1);
IP = (EditText) findViewById(R.id.serverIp);
UserName = (EditText) findViewById(R.id.userName);
Password = (EditText) findViewById(R.id.password);
Port = (EditText) findViewById(R.id.port);
progressBar1 = (ProgressBar) findViewById(R.id.progressBar1);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
new asyncTaskUpdateProgress().execute();
}
});
}
public class asyncTaskUpdateProgress extends AsyncTask<Void, Void, Void> {
#Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
}
#Override
protected void onPreExecute() {
// TODO Auto-generated method stub
progressBar1.setVisibility(View.VISIBLE);
UserStr = UserName.getText().toString();
PassStr = Password.getText().toString();
IPStr = IP.getText().toString();
PortInt = Integer.parseInt(Port.getText().toString());
button.setClickable(true);
progressBar1.setVisibility(View.INVISIBLE);
}
#Override
protected void onProgressUpdate(Void... values) {
// TODO Auto-generated method stub
progressBar1.setVisibility(View.INVISIBLE);
}
#Override
protected Void doInBackground(Void... arg0) {
boolean ok = false;
try {
SSHTest sshtest = new SSHTest();
ok = sshtest.sshconnect(UserStr, PassStr, IPStr, PortInt);
}
catch (Exception e) {
e.printStackTrace();
Log.i("ERROR HERE", "doInBackground: IOException");}
if (ok) {
Toast.makeText(getApplicationContext(),
"Connection Susccessfull", Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(getApplicationContext(),
"Unable to connect", Toast.LENGTH_LONG).show();
notify(getApplicationContext(), true);
}
return null;
}
protected void notify(Context context, Boolean on) {
NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
ComponentName comp = new ComponentName(context.getPackageName(),
getClass().getName());
Intent intent = new Intent().setComponent(comp);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, Intent.FLAG_ACTIVITY_NEW_TASK);
Notification n = new Notification(R.drawable.warning, "Message",
System.currentTimeMillis());
n.setLatestEventInfo(context, "Vedas Server Monitor",
"Port Un-rechable", pendingIntent);
nm.notify(22, n);
}
}
}
android× 194760
There are some correction that you need to make in the doInBackground(). But before that a small detailing about the AsyncTask.
AsyncTask is used when you have any non-UI back ground activity to perform. The function onPreExecute() is used to show any UI action
(in most cases its showing of a dialog) before you enter the background thread. The function doInBackground() is used to perform the non-ui action (in most cases fetching data from server). While doing the background activity in doInBackground() you may wish to show some progress which you do by using publishProgress() which will internally call the onProgressUpdate() method. On completion of the background activity in doInBackground() you return the result of the activity, if you have any. After you return from the doInBackground() method internally there is call made to the onPostExecute() which will receive the result you have returned in doInBackground() as a parameter. Now onPostExecute() will run on a UI thread and most of the UI action like dismissing of dialog which was shown in onPreExecute(), displaying the result on some UI component etc. happens in this method.
Now to the mistake you are doing in you code:
You are showing a toast or a notification based on the result of your server data fetch using a function notify but you are still in the background non-ui thread. Now this result should ideally be returned and checked in the onPostExecute() and based on its value you can show the UI component of toastor notification.
I hope this explanation helps you in solving your problem.
EDIT
In your case since you can send the boolean type result variable ok to onPostExecute(). For that you need to make the following changes:
in class declaration:
public class asyncTaskUpdateProgress extends AsyncTask<Void, Void, Boolean>
and
protected void onPostExecute(Boolean result){
if (ok) {
Toast.makeText(getApplicationContext(),
"Connection Susccessfull", Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(getApplicationContext(),
"Unable to connect", Toast.LENGTH_LONG).show();
notify(getApplicationContext(), true);
}
}
and finally in
protected Void doInBackground(Void... arg0) {
boolean ok = false;
try {
SSHTest sshtest = new SSHTest();
ok = sshtest.sshconnect(UserStr, PassStr, IPStr, PortInt);
}
catch (Exception e) {
e.printStackTrace();
Log.i("ERROR HERE", "doInBackground: IOException");}
return ok;
}
You can try this
in your protected void onPreExecute() need to add
progressBar = new ProgressDialog(v.getContext());
progressBar.setCancelable(true);
progressBar.setMessage("File downloading ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
//reset progress bar status
progressBarStatus = 0;
then
protected void onProgressUpdate(Void... values) {
progressBarStatus= progressBarStatus + x; // x means any value
progressBar.setProgress(progressBarStatus);
}
after that you need to finish your progressBar in onPostExecute(). like
protected void onPostExecute(Void result) {
progressBar.dismiss();
}
I have tried a lot of ways to trigger the backPressed() event when the progressDialog is displayed. But none works. If I provide progDialog.setcancelable(true); I am able to dismiss the progressDialog but still the onBackPressed() doesn't get triggered.
When ProgressDialog is active if yiou press back key to perform yopur own operations you have to set setOnCancelListener to the progressdialog.
write your logic inside onCancel() method example the whole logic that you have written in onBackPressed() event those things you have to write here.
Sample code
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class CancelProgressDialog extends Activity {
ProgressDialog myProgressDialog = null;
#Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
/* Create a very simple button */
Button b = new Button(this);
this.setContentView(b);
b.setText("Show ProgressBar...");
b.setOnClickListener(myProgressBarShower);
}
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
System.out.println("...any key is pressed....");
if (keyCode == KeyEvent.KEYCODE_BACK)
{
System.out.println("...BackButton is pressed...");
if( (myProgressDialog!= null) && myProgressDialog.isShowing()){
myProgressDialog.dismiss();
}
}
return super.onKeyDown(keyCode, event);
}
/** OnClickListener that fakes some work to be done. */
OnClickListener myProgressBarShower = new OnClickListener() {
// #Override
public void onClick(View arg0) {
// Display an indeterminate Progress-Dialog
myProgressDialog = ProgressDialog.show(CancelProgressDialog.this,
"Please wait...", "Doing Extreme Calculations...", true);
myProgressDialog.setOnCancelListener(new OnCancelListener() {
public void onCancel(DialogInterface arg0) {
// TODO Auto-generated method stub
System.out.println("...cancel button is pressed");
// perform your task here
}
});
myProgressDialog.setCancelable(true);
}
};
}
Thanks
Deepak