Try add the following code in your Activity, instead of XWalkView:
                                @Override
                                public boolean dispatchKeyEvent(KeyEvent event) 
{
                                                if (event.getKeyCode() == 
KeyEvent.KEYCODE_BACK) {
                                                                return true;
                                                }
                                                return false;
                                }



Regards,
Xing

From: Cao, Jenny Q
Sent: Tuesday, June 30, 2015 6:01 PM
To: Vishnu Prakash; 'Neeraj Sahu'; [email protected]; Xu, Xing; Cao, 
Jenny Q
Subject: RE: [Crosswalk-help] XwalkSettings methods query.

+Xing
Could you help on the 2 issues?
For first disable back key issue , Neeraj Sahu  create a bug  
XWALK-4459<https://crosswalk-project.org/jira/browse/XWALK-4459> How to disable 
back button
We also tried to listen the onKeyDown event and skip the event. But meet the 
same issue.
Our sample located at 
https://github.com/crosswalk-project/crosswalk-test-suite/pull/2416
Thanks
Jenny
From: Crosswalk-help 
[mailto:[email protected]] On Behalf Of Vishnu 
Prakash
Sent: Wednesday, June 24, 2015 5:19 PM
To: 'Neeraj Sahu'; [email protected]<mailto:[email protected]>
Subject: Re: [Crosswalk-help] XwalkSettings methods query.

Hi Crosswalk team,
Can you please guide us with the below ask.
Vishnu

From: Neeraj Sahu [mailto:[email protected]]
Sent: Tuesday, June 23, 2015 4:04 PM
To: [email protected]<mailto:[email protected]>
Cc: 'Vishnu Prakash'
Subject: XwalkSettings methods query.

Dear CrossWalk Team,
Greetings!!

May I request you to please help me with the below ask:


1)      How can I ignore navigating back of  website by pressing Systems back 
button?

    2)    I am not able to get the desired functionality (false) passing 
"false"  as arguments to the methods
      # 1 XwalkSettings .setLoadsImagesAutomatically(boolean)
     #2 XwalkSettings .setGeolocationEnabled(boolean)


Here is my code snippet in order to  get the  XwalkSettings object  :

   Class xWalkViewInternalClass = 
Class.forName("org.xwalk.core.internal.XWalkViewInternal");
    Constructor<?>[] constructors = 
xWalkViewInternalClass.getDeclaredConstructors();
    Constructor<?> constructor = null;
    for (int i = 0; i < constructors.length; i++)
    {
        constructor = constructors[i];
        if (constructor.getGenericParameterTypes().length == 2)
        {
            break;
        }
    }
    constructor.setAccessible(true);
    Object classObj = constructor.newInstance(Settings.getContext(), 
SurefoxBrowserScreen.getActivity());
    Method method = xWalkViewInternalClass.getDeclaredMethod("getSettings");
    method.setAccessible(true);
    Object obj = method.invoke(classObj);
    return (XWalkSettings) obj;



Thanks and Regards
Neeraj

_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to