2013-08-16 4 views
0

새로운 조각에 Google지도를 추가하려고합니다.내 조각에 Google지도 추가하기

08-16 16 : 58 : 37.334 : E는/AndroidRuntime (15409) : 치명적인 예외 :하지만 난이 오류 얻을 주를 08-16 16 : 58 : E/AndroidRuntime (15409) : 37.334 android.view.InflateException : 이진 XML 파일 라인 # 2 : 오류 클래스 조각 08-16 16 : 58 : 37.334 : E/AndroidRuntime (15409) : 에서 을 부풀리기 android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:710)) 08-16 16 : 58 : E/AndroidRuntime (15409) : android.view.LayoutInflater.inflate (LayoutInflater.java:467 AT)

.여기

은 단편 실행하는 코드입니다 :

Fragment fragment1 = new MapsFragment(); 
    //fragment.setArguments(arguments); 
    FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); 
    fragmentTransaction.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out); 
    fragmentTransaction.replace(R.id.content_frame, fragment1); 
    fragmentTransaction.addToBackStack(null); 
    fragmentTransaction.commit(); 

을 그리고 여기 내 MapsFragment의 코드입니다 :

import com.rss.main.MainActivity; 

import android.annotation.SuppressLint; 
import android.app.Activity; 
import android.app.Fragment; 
import android.os.Bundle; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 

public class MapsFragment extends Fragment { 

    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 

     LayoutInflater mInflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE); 
     View view = (View) mInflater.inflate(R.layout.maps_view, null); 

//  MainActivity.setShareButtonToVisible(); 
//  MainActivity.setElevatorButtonToInVisible(); 

     return view; 
    } 

    @Override 
    public void onDestroyView() { 
     MainActivity.setShareButtonToInVisible(); 
     super.onDestroyView(); 
    } 


} 

그리고 여기 내 maps_view.xml의 코드입니다 :

<?xml version="1.0" encoding="utf-8"?> 
<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/map" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:name="com.google.android.gms.maps.MapFragment"/> 

어디에 문제가 있습니까?

감사

+0

이 어쩌면 몇 가지 아이디어를 얻을 참조 기한입니다 확인 여부를 http://mobile.tutsplus.com/tutorials/android/android-sdk-working -with-google-maps-application-setup / – Aravin

답변

0

귀하의 Mainactivty가 확장해야 FragmentActivity 구글 플레이 서비스가