应用程序第二次为com.google.android.gms.location.places.ui.PlaceAutocompleteFragment启动崩溃片段

时间:2016-11-23 18:36:41

标签: android android-fragments

    [Test]
    public void TestExercise12()
    {
        Programmeren2Tests.Chapter12Test.TestExercise12(Exercise12);
    }

    public static string Exercise12(string strToRemove, string str)
    {
        strToRemove.Replace("str", "x");
        return str;

    }

通过导航视图,我尝试再次启动片段,崩溃......

logcat:

 <fragment
        android:id="@+id/place_autocomplete_fragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
        />

public class MapFragmnet extends Fragment
{

 @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View mapView= inflater.inflate(R.layout.fragmnet_map, container, false);
  PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
                actvity.getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
return mapView;
}

任何人都可以帮帮我......

   Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Duplicate id 0x7f0d00c3, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.location.places.ui.PlaceAutocompleteFragment
                                                                 at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2205)
                                                                 at android.app.FragmentController.onCreateView(FragmentController.java:98)
                                                                 at android.app.Activity.onCreateView(Activity.java:5559)
                                                                 at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:36)
                                                                 at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:75)

0 个答案:

没有答案