Sorry, forgot to tell you the version i am using.  version 15.443.947

Thanks


________________________________
From: Zhang, Xiaofeng <[email protected]>
Sent: Sunday, December 20, 2015 8:00 PM
To: Jonathon Gray; [email protected]
Subject: RE: [Crosswalk-help] XWalkResourceClient ShouldOveride...- Android - 
Crosswalk Lite


Hi Jonathon



Thanks for using Crosswalk.

Which version you are using? I make a little change of your code, and it works 
well.

From your error log:

android.content.ActivityNotFoundException: No Activity found to handle Intent { 
act=android.intent.action ...

it seems your test devices doesn’t have other browser? The issue shouldn’t be 
caused by xwalkview, could you double check?



          @Override

            public boolean shouldOverrideUrlLoading( XWalkView view, String url 
) {

                    Log.d(TAG, "url  = " + url.toString());

                    Uri uri = Uri.parse( url );

                    if ( uri != null ) {

                        String scheme = uri.getScheme();

                        Log.d(TAG, "SCHEME = " + scheme);

                        boolean shouldOverride =

                                        ( (scheme != null)

                                        || scheme.equalsIgnoreCase( "http" )

                                        || scheme.equalsIgnoreCase( "https" )

                                        || scheme.equalsIgnoreCase( "file" )

                                        || scheme.equalsIgnoreCase( "content" ) 
);

                        Log.d(TAG, "shouldOverride == " + shouldOverride );

                        if ( shouldOverride ) {



                            if ( scheme.equalsIgnoreCase( "ps" ) || 
scheme.equalsIgnoreCase( "pss" ) ) {

                                Uri.Builder builder = uri.buildUpon();

                                builder.scheme( scheme.equalsIgnoreCase( "ps" ) 
? "http" : "https" );

                                uri = builder.build();

                            }

                            Intent intent = new Intent( Intent.ACTION_VIEW, uri 
);

                            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                            startActivity(intent);

                            return true;

                        }

                    }

                return false;

            }



Best Regards :)

Xiaofeng Zhang



From: Crosswalk-help 
[mailto:[email protected]] On Behalf Of 
Jonathon Gray
Sent: Sunday, December 20, 2015 1:36 PM
To: [email protected]
Subject: [Crosswalk-help] XWalkResourceClient ShouldOveride...- Android - 
Crosswalk Lite



Hello All,

I am an intern at a small company that is considering replacing the native 
WebView with Crosswalk.  We are using a custom webview client that now extends 
XWalkResourceClient but we are getting an error in the overridden 
shouldOverrideUrlLoading method.



@Override
public boolean shouldOverrideUrlLoading( XWalkView view, String url ) {
    if ( !Text.isNull( url ) ) {
        LogUtil.d("SCHEME", url.toString(), context);
        Uri uri = Uri.parse( url );
        if ( uri != null ) {

            String scheme = uri.getScheme();
            LogUtil.d("SCHEME ", scheme, context);
            boolean shouldOverride =
                    !( scheme == null
                    || scheme.equalsIgnoreCase( "http" )
                    || scheme.equalsIgnoreCase( "https" )
                    || scheme.equalsIgnoreCase( "file" )
                    || scheme.equalsIgnoreCase( "content" ) );

            if ( shouldOverride ) {

                if ( scheme.equalsIgnoreCase( "ps" ) || 
scheme.equalsIgnoreCase( "pss" ) ) {
                    Uri.Builder builder = uri.buildUpon();
                    builder.scheme( scheme.equalsIgnoreCase( "ps" ) ? "http" : 
"https" );
                    uri = builder.build();
                }
                Intent intent = new Intent( Intent.ACTION_VIEW, uri );
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                LogUtil.d("SCHEME", uri.toString(), context);
                context.startActivity(intent);

                return true;
            }
        }
    }

    return false;
}

The above code works fine in the WebView version of the app but results in an 
error in the XWalk version:



12-19 23:18:31.555    2206-2206/? W/System.err﹕ java.lang.RuntimeException: 
android.content.ActivityNotFoundException: No Activity found to handle Intent { 
act=android.intent.action ...

12-19 23:18:31.555    2206-2206/? W/System.err﹕ at 
org.xwalk.core.internal.ReflectMethod.invoke(ReflectMethod.java:67)

12-19 23:18:31.555    2206-2206/? W/System.err﹕ at 
org.xwalk.core.internal.XWalkResourceClientBridge.shouldOverrideUrlLoading(XWalkResourceClientBridge.java:162)

12-19 23:18:31.555    2206-2206/? W/System.err﹕ at 
org.xwalk.core.internal.XWalkResourceClientBridge.shouldOverrideUrlLoading(XWalkResourceClientBridge.java:155)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
org.xwalk.core.internal.XWalkContentsClientBridge.shouldOverrideUrlLoading(XWalkContentsClientBridge.java:206)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
org.xwalk.core.internal.XWalkContentsClientBridge$InterceptNavigationDelegateImpl.shouldIgnoreNavigation(XWalkContentsClientBridge.java:92)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.os.Handler.dispatchMessage(Handler.java:102)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.os.Looper.loop(Looper.java:135)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.app.ActivityThread.main(ActivityThread.java:5257)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
java.lang.reflect.Method.invoke(Native Method)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
java.lang.reflect.Method.invoke(Method.java:372)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ Caused by: 
android.content.ActivityNotFoundException: No Activity found to handle Intent { 
act=android.intent.action.VIEW dat=data:text/html, ...

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1781)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.app.Instrumentation.execStartActivity(Instrumentation.java:1501)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.app.ContextImpl.startActivity(ContextImpl.java:1243)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.app.ContextImpl.startActivity(ContextImpl.java:1225)

12-19 23:18:31.556    2206-2206/? W/System.err﹕ at 
android.content.ContextWrapper.startActivity(ContextWrapper.java:323)

12-19 23:18:31.557    2206-2206/? W/System.err﹕ at 
com.XCENSORX.core.util.DialogUtil$CustomWebViewClient.shouldOverrideUrlLoading(DialogUtil.java:325)

12-19 23:18:31.557    2206-2206/? W/System.err﹕ at 
java.lang.reflect.Method.invoke(Native Method)

12-19 23:18:31.557    2206-2206/? W/System.err﹕ at 
java.lang.reflect.Method.invoke(Method.java:372)

12-19 23:18:31.557    2206-2206/? W/System.err﹕ at 
org.xwalk.core.internal.ReflectMethod.invoke(ReflectMethod.java:61)

12-19 23:18:31.557    2206-2206/? W/System.err﹕ ... 13 more



Thanks for all the help in the past and let me know if there is anything I 
should include.



BR,

Jonathon






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

Reply via email to