RequestFactory validation fails when including Android maps v2 fragment

寵の児 提交于 2019-12-12 03:35:36

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/14522553/requestfactory-validation-fails-when-including-android-maps-v2-fragment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!