구글 지도를 이용하여 프로그래밍 하고 있는데요
xml파일을 두개 사용해서
기본 뷰 (maps.xml)
전투 뷰 (battle.xml) 이렇게 두개 있는데
setContentView(R.layout.battle)로 전투 뷰로 넘어갓다가
다시 기본 뷰로 넘어오려고 setContentView(R.layout.maps)코드를 사용하면 오류가 납니다 ㅠㅠ
기본 뷰가 fragment로 되어있어서 오류가 발생하는것 같은데 오류를 나지 않게 하려면 어떻게 해야 할까요 ㅠㅠㅠ
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
final SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
아래는 maps.xml파일 입니다
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.jhj.gokemonjhj.MapsActivity"
/>
구글맵 api 사이트에 예제 살펴봐 한번
프래그먼트 띄웠다가 다시 제거하려고 할 때 문제가 생긴다는 거야??