Foros del Web » Programando para Internet » Android »

getFragmentManager a fragment

Estas en el tema de getFragmentManager a fragment en el foro de Android en Foros del Web. Buenas intento transformar un activity a un fragment para usar un slidingmenu y tengo problemas con getFragmentManager , espero que me puedan ayudar...he buscado por ...
  #1 (permalink)  
Antiguo 16/03/2015, 10:06
 
Fecha de Ingreso: junio-2014
Mensajes: 25
Antigüedad: 9 años, 10 meses
Puntos: 0
getFragmentManager a fragment

Buenas intento transformar un activity a un fragment para usar un slidingmenu y tengo problemas con getFragmentManager , espero que me puedan ayudar...he buscado por todos lados

mi xml file:

Código XML:
Ver original
  1. <fragment xmlns:android="http://schemas.android.com/apk/res/android"
  2.    xmlns:tools="http://schemas.android.com/tools"
  3.    android:layout_width="match_parent"
  4.    android:layout_height="match_parent"
  5.    android:id="@+id/map"
  6.    tools:context="xpak.xparking.MapsFragment"
  7.    class ="com.google.android.gms.maps.SupportMapFragment" />

mi parte del java file donde esta el error:

Código Java:
Ver original
  1. private void setUpMapIfNeeded() {
  2.         if (mMap == null) {
  3.             // Try to obtain the map from the SupportMapFragment.
  4.            mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map))
  5.                     .getMap();
  6.  
  7.             // Check if we were successful in obtaining the map.
  8.             if (mMap != null) {
  9.                 setUpMap();
  10.             }
  11.         }
  12.     }

error: incompatible types , cannot cast "android.app.fragment" to "com.google.android.gms.maps.supportmapfragmen t"

he buscado tanto que ya me se el error de memoria , estoy usando extends Fragment

Gracias por su ayuda en adelantado

Etiquetas: activity, androi
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:26.