包括Android地图v2的片段时RequestFactory验证失败 [英] RequestFactory validation fails when including Android maps v2 fragment
问题描述
我已经成功地使用 RequestFactory
在我的Android应用程序很长一段时间,但现在想升级到地图V2,当我有当
<片段
的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:ID =@ + ID /图
机器人:layout_width =match_parent
机器人:layout_height =match_parent
类=com.google.android.gms.maps.SupportMapFragment/>
在我的XML布局文件,我得到的错误:
8月1日至25日:08:41.978:E / AndroidRuntime(19854):
了java.lang.RuntimeException:无法恢复活动{com.xx / com.xx.MyActivity}:
了java.lang.RuntimeException:本RequestFactory ValidationTool必须
运行该com.xx.client.MyRequestFactory RequestFactory类型
块引用>如果我从布局XML删除片段code文件,一切工作正常。
这将如何影响片段我RequestFactory验证,我该如何解决这个问题?
感谢。
解决方案作为<一指出, href=\"http://stackoverflow.com/questions/8049351/how-to-use-the-gwt-requestfactory-in-android-syncadapter-always-getting-validat\">How以使用GWT-RequestFactory Android中SyncAdapter(总是让ValidationTool错误)
如果加上
Thread.currentThread()setContextClassLoader(mContext.getClassLoader());
在
requestFactory = RequestFactorySource.create(factoryClass);
问题是固定的。
I have successfully used
RequestFactory
for a very long time in my Android app, but now when trying to upgrade to maps v2, when I include<fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" />
in my XML layout file, I get the error:
01-25 08:08:41.978: E/AndroidRuntime(19854): java.lang.RuntimeException: Unable to resume activity{com.xx/com.xx.MyActivity}: java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the com.xx.client.MyRequestFactory RequestFactory type
If I remove the fragment code from the layout XML file everything works fine.
How does this fragment affect my RequestFactory validation and how can I fix it?
Thanks.
解决方案As pointed out in How to Use the GWT-RequestFactory in Android SyncAdapter (always getting ValidationTool-Error)
if one adds
Thread.currentThread().setContextClassLoader(mContext.getClassLoader());
before
requestFactory = RequestFactorySource.create(factoryClass);
the problem is fixed.
这篇关于包括Android地图v2的片段时RequestFactory验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!