android - Can't add Google Map to Navigation Drawer fragment -


I'm trying to create an app for Android and I'm looking to map in a navigation drawer. Drawer options open new pieces, but map pieces can not be used to work.

MainActivity.java sets this piece in the following manner:

  / ** * Selected binary list items * * / personal Displaying fragment view for zero display view {//} Change the main content by changing the fragments of the piece piece slice = zero; Switch (position) {case 0: piece = new homeframe (); break; Case 1: section = new polypegement (); break; Case 2: piece = new tilepha fragment (); break; Case 3: Section = New Dromolyagration (); break; Case 4: Segment = New XartisFragment (); break; Default: Break; } If (piece! = Null) {fragment manager piece manager = matching-fragmentation (); FragmentManager.beginTransaction () .replace (R.id.frame_container, fragment) .commit (); // Update items and titles, then remove drawer mDrawerList.setItemChecked (position, true); MDrawerList.setSelection (status); // setTitle (navMenuTitles [status]); MDrawerLayout.closeDrawer (mDrawerList); } Else {/} fragment Log.e create error ("main activity", "error in piece making"); }}  

The map piece ( XartisFragment.java ) is the following:

  import android.os.Bundle; Import android.support.v4.app.Fragment; Import android.view.LayoutInflater; Import android.view.View; Import android.view.ViewGroup; Import com.google.android.gms.maps.GoogleMap; Import com.google.android.gms.maps.SupermarkMapFragment; Public Class XartisFragment Piece Extension (Private GoogleMap Map; Public View onCreateView (LayoutInflater Inflator, ViewGroup Container, Bundle savedInstanceState) {see rootView = inflater.inflate (R.layout.map_layout, container, false); Map = ((SupportMapFragment) getActivity ) getSupportFragmentManager () findFragmentById (R.id.map) ..) getMap (); .. // (. (SupportMapFragment) getChildFragmentManager () findFragmentById (R.id.map)) getMap (); return route scene;}}  

map_layout.xml is the following:

  & lt; RelativeLayout xmlns: android = "http: // Schemas.android .com / apk / res / android "android: layout_width =" fill_parent "android: layout_height =" fill_parent "& gt; LT; piece android: id = "@ + id / map" android: name = "com.google.android.gms.maps.SupportMapFragment" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: layout_marginTop = " 8 DP "/> & lt; / RelativeLayout & gt;  

When I do try to run it I have:

  error: (178, 15) the error did not change in incompatible types: XartisFragment piece < Can be / code>  

This error tells the main activity in this line. Java

  fragment = new XartisFragment ();  

Any ideas about what changes to make this load?

getSupportFragmentManager () instead of getFragmentManager () . Try to use

or

Make sure that both the places are importing the same piece of square. It seems that in the same place you are importing Android.app.Fragment (native API level 11 version of the piece) and elsewhere you are importing Android. Support.v4.app.Fragment (pieces package from Android support).


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -