Prototik / HoloEverywhere

NO LONGER MAINTAINED. DEVELOP FOR 4.X+ DUDE.
MIT License
2.18k stars 607 forks source link

IllegalStateException, SupportMapFragment did not create a view #619

Closed dexxtr closed 11 years ago

dexxtr commented 11 years ago

I've a google map on fragment:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
.....
</Rel...>

and have such peace of code where exception has occurred

sView = inflater.inflate(R.layout.fragment_map, container, false);

I've got an exception. What I do wrong or HE does not support SupportMapFragment?

09-11 22:50:06.111: E/AndroidRuntime(14521): FATAL EXCEPTION: main
09-11 22:50:06.111: E/AndroidRuntime(14521): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.example.activities.MainActivity}: java.lang.IllegalStateException: Fragment com.google.android.gms.maps.SupportMapFragment did not create a view.
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1872)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.ActivityThread.access$1500(ActivityThread.java:135)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.os.Looper.loop(Looper.java:150)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.ActivityThread.main(ActivityThread.java:4385)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at java.lang.reflect.Method.invokeNative(Native Method)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at java.lang.reflect.Method.invoke(Method.java:507)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at dalvik.system.NativeStart.main(Native Method)
09-11 22:50:06.111: E/AndroidRuntime(14521): Caused by: java.lang.IllegalStateException: Fragment com.google.android.gms.maps.SupportMapFragment did not create a view.
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app._HoloFragmentInflater.inflate(_HoloFragmentInflater.java:69)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app._HoloFragmentInflater.inflate(_HoloFragmentInflater.java:98)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:428)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:731)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:538)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:488)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at com.example.map.MapFragment.onCreateView(MapFragment.java:98)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app._HoloFragment.onCreateView(_HoloFragment.java:173)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at org.holoeverywhere.app.Activity.onStart(Activity.java:449)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1201)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.Activity.performStart(Activity.java:3955)
09-11 22:50:06.111: E/AndroidRuntime(14521):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1845)
09-11 22:50:06.111: E/AndroidRuntime(14521):    ... 11 more
Prototik commented 11 years ago

Works nicely for me: device-2013-09-13-183000

Prototik commented 11 years ago

Also checkout please this application. If bug not occurs for it: bug in your code/build env

dexxtr commented 11 years ago

It's working well, thanks! It's my problem, will be investigate. Thank you one more time! ;)

cinash commented 11 years ago

I have got the same exception when I put SupportMapFragment as a child fragment (added from xml) inside a holoeverywhere Fragment. It seems that org.holoeverywhere.LayoutInflater is not creating a view for this fragment, because mCurState=0 in mChildFragmentManager.

Everything works fine when I use android.support.v4.app.Fragment, probably because in that case the standard LayoutInflater is used.

yachi commented 11 years ago

Got same exception too when using SupportMapFragment as a child of holoeverywhere fragment. Had to use android.support.v4.app.Fragment.

Terel commented 10 years ago

Still not fixed. I'm using the google maps fragment inside a holoeverywhere fragment and get the same error as OP. Any help?

alexthec0d3r commented 10 years ago

Still not fixed. Got the same exception too

Prototik commented 10 years ago

O, rlly? Just now checked out: works fine. device-2014-03-27-160436

alexthec0d3r commented 10 years ago

Prototik, could you post source for your app?

I have this issue when

fragment_layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <fragment
        android:id="@+id/fm_map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>

and in MapFragment_ class which extends org.holoeverywhere.app.Fragment have

contentView_ = inflater.inflate(layout.fragment_map, container, false);

then in Activity, which extends org.holoewerywhere.app.Activity I have

MapFragment fragment = new MapFragment_();  
getSupportFragmentManager().beginTransaction().add(R.id.am_fragment_container, fragment).commit();

also I'm using AndroidAnnotations

BraisGabin commented 10 years ago

Here it's: https://github.com/Prototik/HoloEverywhere/blob/master/issues/src/org/holoeverywhere/issues/i619/MainActivity.java

vivak commented 10 years ago

Hello there! Can you please add a similar example of google map with HE with HoloFragment? I am having problem with embedding google map into it and I don't want to use HoloActivity for that. Thanks in advance!