Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6630075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:21:05+00:00 2026-05-25T22:21:05+00:00

I am trying to create a layout consists of mapview and textfield and buttons

  • 0

I am trying to create a layout consists of mapview and textfield and buttons align at the bottom of the layout

I tryied using this xml file :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/google_maps"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:apiKey="@string/maps_key" />
    <LinearLayout 
        android:id="@+id/linearLayout1" 
        android:layout_height="wrap_content" 
        android:layout_width="match_parent"
        android:padding="5dp" 
        android:orientation="vertical">
        <TextView 
            android:text="@string/txtLocationDescription" 
            android:layout_height="wrap_content" 
            android:id="@+id/textView1" 
            android:layout_width="wrap_content"></TextView>
        <EditText 
            android:id="@+id/editText1" 
            android:layout_height="wrap_content" 
            android:layout_width="match_parent"></EditText>
        <LinearLayout 
        android:id="@+id/linearLayout2" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        android:weightSum="1.0"
        android:layout_width="match_parent">
            <Button android:id="@+id/Button1" 
                    android:layout_width="wrap_content" 
                    android:layout_height="wrap_content" 
                    android:layout_weight="0.5"
                    android:text="@string/btnAddNewLocation"></Button>
            <Button android:layout_height="wrap_content" 
                    android:id="@+id/button2" 
                    android:layout_width="wrap_content"
                    android:layout_weight="0.5"
                    android:text="@string/btnCancelAddingLocation"></Button>

        </LinearLayout>
    </LinearLayout>
</LinearLayout>

But I got this error :

09-28 14:49:47.476: ERROR/AndroidRuntime(455): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.uis/com.android.uis.LocationManagementActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.maps.MapView
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.os.Looper.loop(Looper.java:123)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.ActivityThread.main(ActivityThread.java:3647)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at java.lang.reflect.Method.invokeNative(Native Method)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at java.lang.reflect.Method.invoke(Method.java:507)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at dalvik.system.NativeStart.main(Native Method)
09-28 14:49:47.476: ERROR/AndroidRuntime(455): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.google.android.maps.MapView
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.Activity.setContentView(Activity.java:1657)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.android.uis.LocationManagementActivity.onCreate(LocationManagementActivity.java:10)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     ... 11 more
09-28 14:49:47.476: ERROR/AndroidRuntime(455): Caused by: java.lang.reflect.InvocationTargetException
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at java.lang.reflect.Constructor.constructNative(Native Method)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at android.view.LayoutInflater.createView(LayoutInflater.java:505)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     ... 21 more
09-28 14:49:47.476: ERROR/AndroidRuntime(455): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.google.android.maps.MapView.<init>(MapView.java:291)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.google.android.maps.MapView.<init>(MapView.java:264)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     at com.google.android.maps.MapView.<init>(MapView.java:247)
09-28 14:49:47.476: ERROR/AndroidRuntime(455):     ... 24 more

What is the problem and how may I do that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:21:06+00:00Added an answer on May 25, 2026 at 10:21 pm

    You can’t put things inside a MapView. A better solution is to put the MapView inside a RelativeLayout and lay out the buttons on top of it inside the top-layer RelativeLayout.

    EDIT:

    Basic example:

    <RelativeLayout>
       <MapView></MapView>
       <Button></Button>
       <Button></Button>
       <TextView></TextView>
       *****Any other layout you want ****
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an example layout that I'm trying to create in android using xml.
Im trying to create a layout in flex using mxml, the layout contains a
I'm trying to create a layout similar to this: alt text http://img20.imageshack.us/img20/3533/stackn.png Here's the
I'm trying to create a scrollable layout in Android. Even using developers.android.com, though, I
I'm trying to create a class that can be added to a Layout file,
I'm trying to create a layout for my website and I'm stuck with this.
I've been trying to create a layout like this: Now I'm not asking for
I’m trying to create a layout with 4 buttons, where the top on button
I am trying to create a fixed layout and using Bootstrap for mainly the
i am trying to create a css layout using pixels and percentages. the reason

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.