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, int
id) {
                           Log.d(TAG, "onClick(): entered...");
                       }
           })
           .setNegativeButton("No", new DialogInterface.OnClickListener
() {
                       public void onClick(DialogInterface dialog, int
id) {
                            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 toast notification to display caller
> 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
> notification longer 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 their Caller ID app.
>
> http://blog.whitepages.com/2009/02/27/caller-id-by-whitepages-a-new-a...

--~--~---------~--~----~------------~-------~--~----~
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