OK. Then it seems XWalkView lives in Activity, and Service talk to Activity. Can you help to file a bug at https://crosswalk-project.org/jira/ and provide sample code for us to reproduce?
Regards, Xing From: Kamil Krzyszczuk [mailto:[email protected]] Sent: Tuesday, August 11, 2015 9:10 AM To: Xu, Xing Subject: RE: [Crosswalk-help] How to instantiate XWalkView or XWalkViewInternal inside a Service instead of Activity I'm not quite sure how it works. But I've done it with regular Webview and Service. My service is set to be foreground. So when my activity crash or is garbage-collected. Service still keeps reference to Webview. When user tap on app/activity to reopen it, Activity is recreated and by talking to Service, Activity repin/re-add WebView to his view hierarchy. This is important functionallity for me and it works with regular webview. Besides of it. Some apps create custom Window with View hierarchy, without any Activity and it works too. 11 sie 2015 03:00 "Xu, Xing" <[email protected]<mailto:[email protected]>> napisał(a): Any android view including XWalkView must live in a “Window”. Window can be Activity/PopupWindow/Dialog/… Without “Window”, you cannot put android view into Service. Do you have any kind of “Window” in your service? Did you try any other android view in your service? Regards, Xing From: Crosswalk-help [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Kamil Krzyszczuk Sent: Monday, August 10, 2015 11:24 PM To: [email protected]<mailto:[email protected]> Subject: [Crosswalk-help] How to instantiate XWalkView or XWalkViewInternal inside a Service instead of Activity As in title: How to instantiate XWalkView or XWalkViewInternal inside a Service instead of Activity It gives me runtime errors in every scenarios: webView = new XWalkView(this); webView = new XWalkView(this, (Activity)null); and XWalkViewInternal too, for example error output: Process: com.example.test, PID: 28970 java.lang.RuntimeException: Unable to start service com.example.test.Service@42d4d600<mailto:com.example.test.Service@42d4d600> with Intent { cmp=com.example.test/.Service}: java.lang.NullPointerException at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3044) at android.app.ActivityThread.access$2200(ActivityThread.java:172) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5694) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at org.xwalk.core.internal.XWalkInternalResources.doResetIds(XWalkInternalResources.java:28) at org.xwalk.core.internal.XWalkInternalResources.resetIds(XWalkInternalResources.java:72) at org.xwalk.core.internal.XWalkViewDelegate.init(XWalkViewDelegate.java:130) at org.xwalk.core.internal.XWalkViewDelegate.init(XWalkViewDelegate.java:89) at org.xwalk.core.internal.XWalkViewInternal.init(XWalkViewInternal.java:261) at org.xwalk.core.internal.XWalkViewInternal.<init>(XWalkViewInternal.java:254) at com.example.test.Service.startWebView(Service.java:184) at com.example.test.Service.onStartCommand(Service.java:107) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3027) at android.app.ActivityThread.access$2200(ActivityThread.java:172) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5694) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) at dalvik.system.NativeStart.main(Native Method)
_______________________________________________ Crosswalk-help mailing list [email protected] https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help
