[android-developers] Re: Is it possible to use the UI controls while the ProgressDialog is on?

2011-12-20 Thread srihari babu
build custom progress dialog, which is a combination of progress bar  and a 
button.

Regards,
Srihari

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Is it possible to use the UI controls while the ProgressDialog is on?

2011-12-20 Thread B.Arunkumar
Hi,

   This can be done. What I want is a way to use the same button for
showing the progressdialog and later cancelling it. Probably I should
go in for some animated imagview instead of progressdialog for my
requirement, I guess.

Thank you,
B.Arunkumar

On Dec 20, 3:58 pm, srihari babu  wrote:
> build custom progress dialog, which is a combination of progress bar  and a
> button.
>
> Regards,
> Srihari

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Is it possible to use the UI controls while the ProgressDialog is on?

2011-12-20 Thread Kostya Vasilyev
Um, unless I'm missing something...

You can't use the same button because presumably the button to launch
the long-running operation is not in the dialog, it's in the activity
- and dialogs prevent interaction with activity UI elements while
displayed.

What you can do is one of:

1) Build your own dialog with a cancel button;

2) Use Dialog.setOnCancelListener which gets called if the user
presses the Back key; here the dialog is dismissed automatically;

3) Set a key listener in the dialog and check for when the back key is
pressed, something like:

mProgressDialog = new ProgressDialog(mActivity);


mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setMax(item.fetch_decoded_size / 1024);

mProgressDialog.setTitle(R.string.attachment_dialog_title);
mProgressDialog.setCancelable(false);
mProgressDialog.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, 
int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && 
event.getAction() ==
KeyEvent.ACTION_UP
&& 
event.getRepeatCount() == 0) {
cancelDownload();
return true;
}
return false;
}
});

In this code, canceling the operation can take some time, so I made
the dialog non-cancelable to be able display "Canceling...".

-- Kostya

20 декабря 2011 г. 15:32 пользователь B.Arunkumar
 написал:
> Hi,
>
>   This can be done. What I want is a way to use the same button for
> showing the progressdialog and later cancelling it. Probably I should
> go in for some animated imagview instead of progressdialog for my
> requirement, I guess.
>
> Thank you,
> B.Arunkumar
>
> On Dec 20, 3:58 pm, srihari babu  wrote:
>> build custom progress dialog, which is a combination of progress bar  and a
>> button.
>>
>> Regards,
>> Srihari
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Is it possible to use the UI controls while the ProgressDialog is on?

2011-12-20 Thread TreKing
2011/12/20 Kostya Vasilyev 

> 1) Build your own dialog with a cancel button;
>
> 2) Use Dialog.setOnCancelListener which gets called if the user
> presses the Back key; here the dialog is dismissed automatically;
>
> 3) Set a key listener in the dialog and check for when the back key is
> pressed
>

4) Instead of a Dialog, use a
ProgressBar
embedded in
the same layout as the button.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en