Android Maps App Not Finding The Correct MapView
I have made an app that uses Google Android Maps API V2 and I have followed every step in the guide provided by Google but it doesn't work unfortunely and it crashes every time I t
Solution 1:
Have you tried just inflating the xml layout normally with setContentView? Right now it looks like you're trying to make a fragment from an xml fragment.
Solution 2:
In activity_main.xml you shouldn't have a map fragment, since you add it programatically.
What I would do would be to change activity_mail.xml to contain a Framelayout that will be the fragment container. So for example:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
after that in MainActivity.java you should findViewbyId for the Framelayout and add the mapfragment.
Also it is strange that you get an error for MapView but there isn't one in your code. Maybe you could post more of your code?
Post a Comment for "Android Maps App Not Finding The Correct MapView"