I think you are trying to handle the key in your activity - whereas you should be handling it in the dialog.

http://developer.android.com/reference/android/app/Dialog.html#setOnKeyListener(android.content.DialogInterface.OnKeyListener)

dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
    @Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
        handle BACK_KEY here
    }
});

Just make sure there is way for the user to close the dialog.

Also consider using an Activity instead of the dialog.

-- Kostya

10.02.2011 16:39, Abhilash baddam пишет:
hi kostya,

but if i do as u told back button is not working...? Any alternate for this ?

On Thu, Feb 10, 2011 at 6:46 PM, Kostya Vasilyev <[email protected] <mailto:[email protected]>> wrote:

    Um, if you don't want that, call dialog.setCancellable(false) ?

    10.02.2011 15:53, Abhilash baddam пишет:
    Hi,

              if i give dialog.setCancellable(true); the the dialog
    box is dismissing...? what shall i do?

    On Thu, Feb 10, 2011 at 6:14 PM, Abhilash baddam
    <[email protected]
    <mailto:[email protected]>> wrote:

        Hi Marcin,

                       What u have sent the link, is helped me alot
        in general webview but here i am displaying the webview in
        Customized Dialog.
        Here i used dialog.setCancellable(false);  and i used back
        button functionality like this its not working in
        dialog..what may be the reason.

        @Override
        public  boolean  onKeyDown(int  keyCode,  KeyEvent  event)  {


             if  ((keyCode==  KeyEvent.KEYCODE_BACK)  &&  mWebView.canGoBack()) 
 {


                 mWebView.goBack();

                 return  true;


             }
             return  super.onKeyDown(keyCode,  event);


        }

        On Thu, Feb 10, 2011 at 5:13 PM, Marcin Orlowski
        <[email protected] <mailto:[email protected]>>
        wrote:

            On 10 February 2011 12:03, Abhilash baddam
            <[email protected]
            <mailto:[email protected]>> wrote:

            > I have a problem, in my application i am displaying
            webview in customized
            > dialog. suppose if the user browse 5 pages in the
            webview how can he come
            > back to previous page, if i click on back button the
            dialog is dismissing.

            Read here:
            
http://developer.android.com/resources/tutorials/views/hello-webview.html
            Point 9 discuss your case

            --
            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]
            <mailto:[email protected]>
            To unsubscribe from this group, send email to
            [email protected]
            <mailto:android-developers%[email protected]>
            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
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en


-- Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com

-- 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]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    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 [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


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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