2016-03-22 12 views
0

google haritalarımın parçalarımdan (sekmeler) birine kod yazmak için yazdım ve harita üzerinde bir sorun yaşamaya devam ediyorum. . tüm kütüphanelerim derlendi, notu senkronize ettim ve hala çalışmıyor, ben hala android için yeniyim, bu benim en güçlü alanım değil. Burada android stüdyosunda google maps api ile ilgili problemler

burada

package com.example.hp_user.shoutfinal28; 



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.MapFragment; 

import com.google.android.gms.maps.GoogleMap; 

import com.google.android.gms.maps.OnMapReadyCallback; 



public class FragmentShouts_Maps extends Fragment implements onMapReadyCallback { View view = inflater.inflate(R.layout.fragmentshouts_maps, container, false); 
public View onCreateView(LayoutInflater inflater, ViewGroup container, 
         Bundle savedInstanceState) { 
    // Get the view from fragment shouts.xml 
    return inflater.inflate(R.layout.fragmentshouts_maps, container, false); 

    MapFragment fragment = (MapFragment)getChildFragmentManager().findFragmentById(R.id.maps); 
    fragment.getMapAsync(this); 
} 


@Override 
public void onViewCreated(View view, Bundle savedInstanceState) { 
    super.onViewCreated(view, savedInstanceState); 




} 

@Override 
public void onMapReady (GoogleMap googleMap) 




} 

altına kodum i onMapReadyCallback ilk harfi büyük olmalıdır

public class FragmentShouts_Maps extends Fragment implements onMapReadyCallback { 

hattı Haritalar

<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/maps" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    class="com.example.hp_user.shoutfinal28.FragmentShouts_Maps" 
    android:layout_alignParentEnd="true"> 
</fragment> 

</RelativeLayout> 

cevap

0

beyan xml dosyası olan : OnMapReadyCallback

Not: Bahsettiğiniz hatayla ilgili, ama aynı zamanda onCreateView yönteminin içine hattını

View view = inflater.inflate(R.layout.fragmentshouts_maps, container, false); 

taşımak zorunda değil.

+0

Teşekkür ederim, onun çalışması, onCreateView'a taşıdım ve bunun yerine görünüm döndürdüm. @ozlem –

+0

şimdi, harita çizimleriyle ilgili bir problemim var, bütün satır, tersinmez tür diyor ** _ MapFragment fragment = (MapFragment) getChildFragmentManager(). findFragmentById (R.id.maps); _ ** @Ozlem –

+0

xml dosyasını gönderebilir misiniz? R.id.maps'i nerede tanımladın? – ozo