0

I'm trying to get my Google Map in Android to show me my lcoation. Java is showing no errors.

<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".MainActivity" >

<TextView
    android:id="@+id/tv_location"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<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:layout_below="@id/tv_location"
    class="com.google.android.gms.maps.SupportMapFragment" />

</RelativeLayout>

Error is showing that xmlns is apparently invalid for the fragment tag. Any suggestions?

2 Answers 2

1

The xmlns:android attribute is a namespace declaration and only should be on the root layout in your XML file.

Sign up to request clarification or add additional context in comments.

4 Comments

IOW, delete xmlns:android="http://schemas.android.com/apk/res/android" from your <fragment> element.
@CommonsWare That's sorta fixed it, no errors, but the app just crashes... back to the drawing board.
@JordanMoffat: Use LogCat to look at the stack trace associated with your crash. Then, ask a fresh SO question if you still cannot figure out the source of your difficulty.
@CommonsWare fixed it now, was an unrelated problem. Thanks for your help!
0

try including this in your fragment

xmlns:map="http://schemas.android.com/apk/res-auto"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.