likaci

How to Add MapView to Fragment ?

Discussion created by likaci on Mar 20, 2014
Latest reply on Mar 20, 2014 by likaci
Hello there. I am using agis sdk 10.2.2 with Android API 19.
I add a MapView to MainActiviety it works.
When I add a Blank MapView to Fragment it works too,.
But when I Add a Layer to MapView of Fragment, App crashed.

Does anyone has an example to show how to add MapView to Fragment ?
Thanks.

03-21 02:09:52.204: D/AndroidRuntime(1968): Shutting down VM
03-21 02:09:52.204: W/dalvikvm(1968): threadid=1: thread exiting with uncaught exception (group=0xa4d0fb20)
03-21 02:09:52.204: E/AndroidRuntime(1968): FATAL EXCEPTION: main
03-21 02:09:52.204: E/AndroidRuntime(1968): Process: com.example.test4nofragment, PID: 1968
03-21 02:09:52.204: E/AndroidRuntime(1968): java.lang.NullPointerException
03-21 02:09:52.204: E/AndroidRuntime(1968):  at com.example.test4nofragment.MainActivity$1.onClick(MainActivity.java:41)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at android.view.View.performClick(View.java:4438)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at android.view.View$PerformClick.run(View.java:18422)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at android.os.Handler.handleCallback(Handler.java:733)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at android.os.Handler.dispatchMessage(Handler.java:95)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at android.os.Looper.loop(Looper.java:136)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at android.app.ActivityThread.main(ActivityThread.java:5017)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at java.lang.reflect.Method.invokeNative(Native Method)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at java.lang.reflect.Method.invoke(Method.java:515)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-21 02:09:52.204: E/AndroidRuntime(1968):  at dalvik.system.NativeStart.main(Native Method)
03-21 02:09:52.472: D/dalvikvm(1968): GC_FOR_ALLOC freed 223K, 9% free 2952K/3228K, paused 13ms, total 15ms
03-21 02:09:53.440: D/NoDataTile(1968): ETag retrieved="1o5eqai7ae2"
03-21 02:09:53.512: D/dalvikvm(1968): GC_FOR_ALLOC freed 337K, 12% free 3115K/3512K, paused 9ms, total 10ms
03-21 02:09:53.512: I/dalvikvm-heap(1968): Grow heap (frag case) to 3.341MB for 262156-byte allocation
03-21 02:09:53.524: D/dalvikvm(1968): GC_FOR_ALLOC freed <1K, 11% free 3371K/3772K, paused 6ms, total 6ms
03-21 02:09:53.544: D/ArcGIS(1968): Not blank

Outcomes