Hey Bolha,

 Yes, I implemented the similar thing by overriding onKeyDown and
checking keycode

 Will be working on the incoming call case tomorrow :)

On Feb 26, 6:29 pm, Bolha <[email protected]> wrote:
> Hey, Amit!
>
> Specifically to the search button problem, I've found the following
> solution:
>
> case DIALOG_PROGRESS_SPINNER:
>                         progressDialog = new ProgressDialog(this) {
>                                 @Override
>
>                                 public boolean onSearchRequested() {
>                                         return false;
>                                 }
>                         };
>                         
> progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
>                         progressDialog.setMessage("Loading");
>                         progressDialog.setCancelable(false);
>
>                         return progressDialog;
>                 }
>
> As the code above, try to override the onSearchRequested in the
> ProgressDialog class (or any other class you want no to be interrupted
> by the search box). If you return false, the event is invalidated and
> the search button isn't shown. But, for income calls and other events
> that interrupt you application, the dialog probably will be hidden.
> I was trying something related to the android:configChanges="...", but
> without success. If you find something that solves your problem in a
> more general way, please, let us know (hehe, I've just found my app
> suffers from something similar...)
>
> Thanks for the attention!
>
> Bolha
>
> On 26 fev, 03:52, A R <[email protected]> wrote:
>
> > Bolha, Thanks for responding.
>
> > Dialog is created using onCreateDialog and I am invoking it by
> > showDialog(int id)
>
> > Below is the code. When my PurchaseActivity starts I do not want the
> > dialog to go away until I get response from the server but clicking on
> > the search button removes it. For now I have created a customer
> > ProgressDialog class and eating the search button, which makes sure
> > dialog doesnt go, but there will be other scenarios like incoming call
> > which will remove the dialog
>
> > public abstract class MyBaseActivity extends Activity {
> >         public static final int DIALOG_PROGRESS_SPINNER = 3;
>
> >         Handler handler = new Handler();
> >         ProgressDialog progressDialog;
>
> >         protected Dialog onCreateDialog(int id) {
> >                 switch (id) {
> >                 case DIALOG_PROGRESS_SPINNER:
> >                         progressDialog = new ProgressDialog(this);
> >                         
> > progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
> >                         
> > progressDialog.setMessage(getString(R.string.loading));
> >                         progressDialog.setCancelable(false);
>
> >                         return progressDialog;
> >                 }
> >                 return super.onCreateDialog(id);
> >         }
>
> > }
>
> > public class PurchaseActivity extends MyBaseActivity {
> >         protected void onCreate(Bundle savedInstanceState) {
> >                 super.onCreate(savedInstanceState);
>
> >                 setContentView(R.layout.purchase_screen);
>
> >                 //do other stuff
>
> >                 handler.post(new Runnable() {
>
> >                         @Override
> >                         public void run() {
> >                                 showDialog(DIALOG_PROGRESS_SPINNER);
> >                                 //call asynch thread to do some server work 
> > which will call
> > listener in the same activity to dismiss dialog
> >                         }
> >                 });
>
> >         }
>
> > }
>
> > On Feb 26, 4:08 am, Bolha <[email protected]> wrote:
>
> > > Amit,
>
> > > How are you creating the dialog? Sometimes, when creating a dialog
> > > outside the overriden method "onCreateDialog" (from Activity class),
> > > the dialog can have strange behaviors (mainly because it sometimes the
> > > dialog instance is lacking a reference to its parent). Can you post a
> > > piece of your source code?
>
> > > Thanks
>
> > > Bolha
>
> > > On 25 fev, 16:53, A R <[email protected]> wrote:
>
> > > > Hi,
>
> > > >  I have an activity which starts with a progress bar and I do not want
> > > > the progress bar to go away until the processing is done, I have set
> > > > the dialog to be setCancelable(false) so now user cannot cancel it
> > > > with back but there are several other situations which hides the
> > > > dialog for eg pressing 'search'.
>
> > > >  On clicking of 'search' button the search box and keyboard pops up,
> > > > back button hides it and shows my activity which is always in the
> > > > background but the dialog is gone.
>
> > > >  I can disable the search button but ideally I would want dialog to
> > > > come back when the activity comes in foreground again. Any ideas how
> > > > to do it?
>
> > > > Regards,
> > > > Amit.
>
>

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

Reply via email to