Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion InflateException on defining MapView in XML

MIME-Version: 1.0
Message-ID: <2f472278-e6a0-4d88-9581-ca2b221fca1f@c30g2000hsa.googlegroups.com>
Date: Sun, 18 Nov 2007 15:37:11 -0800 (PST)
Received: by 10.90.33.16 with SMTP id g16mr215171agg.1195429031263; Sun, 18 
	Nov 2007 15:37:11 -0800 (PST)
In-Reply-To: <f3d96315-4bda-491b-8845-531b30cf4c25@n20g2000hsh.googlegroups.com>
X-IP: 89.13.168.157
References: <c281532e-e1d5-40e8-96f6-ccd8adba27d9@e4g2000hsg.googlegroups.com> 
	<f3d96315-4bda-491b-8845-531b30cf4c25@n20g2000hsh.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.9) 
	Gecko/20071025 Firefox/2.0.0.9,gzip(gfe),gzip(gfe)
Subject: Re: InflateException on defining MapView in XML
From: plusminus <stoeps...@gmx.de>
To: Android Developers <android-developers@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Hi, daniel

I've also had that during my various, tries. But this is probably not
the source for the problem, as another Exception is thrown...
Can someone explain the meaning of InflateException as I'm not a
native speaker, i do not really understand it.
I think of a balloon that is blown to big...  o_O

Regards, plusminus
http://anddev.org  |  Android Development Community / Tutorials

On Nov 18, 11:31 pm, "daniel.benedykt" <daniel.bened...@gmail.com>
wrote:
> Hi plusminus
>
> I had the same problem, so I decompiled the MapView Class and I found
> the following code in the constructor:
>
>  public MapView(Context context)
>     {
>         super(context);
>         mDrawer = new AndroidGraphics(null);
>         mOverlayBundle = null;
>         mReticle = null;
>         if(context instanceof MapActivity)
>             ((MapActivity)context).setupMapView(this);
>         else
>             throw new IllegalArgumentException("MapViews can only be
> created inside instances of MapActivity.");
>     }
>
> So for some reason is only allowed to create a MapView inside a
> MapActivity.
> I will try to investigate more.
>
> Daniel
>
> On Nov 18, 5:16 pm, plusminus <stoeps...@gmx.de> wrote:
>
> > I get a runtime exception (InflateException) having defined an MapView
> > in XML.
> > "Error inflating class MapView."
> > Using the following code:
> >       <?xml version="1.0" encoding="utf-8"?>
> >       <!-- This is the "Main-Layout" a relative one -->
> >       <RelativeLayout xmlns:android="http://schemas.android.com/apk/
> > res/android"
> >                       android:layout_width="fill_parent"
> >                       android:layout_height="fill_parent">
> >       <!-- What comes within here, is a child of the outer layout -->
> >           <!-- This is the Map all actions will take place -->
> >           <MapView id="@+id/main_map"
> >                     android:layout_width="fill_parent"
> >                     android:layout_height="wrap_content"
> >                     android:text="Type here:"/>
>
> >           <Button id="@+id/zoomin_button"
> >                   android:layout_width="wrap_content"
> >                   android:layout_height="wrap_content"
> >                   android:layout_below="@id/main_map"
> >                   android:layout_alignParentRight="true"
> >                   android:layout_marginLeft="10px"
> >                   android:text="+" />
> >           <Button id="@+id/zoomout_button"
> >                   android:layout_width="wrap_content"
> >                   android:layout_height="wrap_content"
> >                   android:layout_toLeft="@id/zoomin_button"
> >                   android:layout_alignTop="@id/zoomin_button"
> >                   android:text="-" />
> >       </RelativeLayout>
>
> > Also tried to simplify it, always the same exeption...
> > Someone got an explanaition or solution for that ?
>