It seems like there is a problem with the context object perhaps. I'm
using the context from the service running on the device. When the
phonelistener see a state change, it should display a dialog. I've
tried the postDelay in a new thread but it still crashes. Anyone got a
working example of a dialog appearing on top of the caller activity?

On Aug 1, 5:38 pm, Ronald Pompa <[email protected]> wrote:
> It seems like AlertDialog just forces close on the app. as soon as 
> thenotificationis supposed to show, it crashes.
>
> Anyone else got it working?
>
> On Jul 24, 4:41 pm, Arno Becker <[email protected]>
> wrote:
>
> > Hi Ronald,
>
> > try to use a builder for the dialog in the onCallStateChanged-method
> > of your PhoneStateListener.It has to know the Context of your Activity
> > the PhoneStateListener runs in.
>
> > AlertDialog.Builder builder = new AlertDialog.Builder(context);
> > builder.setMessage("Are you sure you want to exit?")
> >           .setCancelable(false)
> >           .setPositiveButton("Yes", new DialogInterface.OnClickListener
> > () {
> >                        public void onClick(DialogInterface dialog, intid) {
> >                            Log.d(TAG, "onClick(): entered...");
> >                        }
> >            })
> >            .setNegativeButton("No", new DialogInterface.OnClickListener
> > () {
> >                        public void onClick(DialogInterface dialog, intid) {
> >                             dialog.cancel();
> >                        }
> >            });
>
> > AlertDialog alert = builder.create();
> > alert.show();
>
> > On Jul 21, 2:57 pm, Ronald Pompa <[email protected]> wrote:
>
> > > Hi.
>
> > > I've got a PhoneStateListener to seecallstate changes, when acall
> > > isincomingI make my app show a toastnotificationto displaycaller
> > > data which I retrieve from a search service. Due to toasts limitation,
> > > i would like to show a dialog instead which allows me to show the
> > >notificationlonger and customize it with imageviews etc...
>
> > > The problem is that when I implement the dialog and execute the show
> > > method in the state listener class, my application crashes.
>
> > > Does anyone know how to implement this and have an example? It seems
> > > like WhitePages have solved this with theirCallerIDapp.
>
> > >http://blog.whitepages.com/2009/02/27/caller-id-by-whitepages-a-new-a...Hide
> > > quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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