Thank you for the solution. It worked for me. I followed Juhak's xml
layout. I only used an EditText with the map. However, I have to
remove the "adroid_weight="1"" field to make the EditText visible. It
must be a bug that we cannot create MapView by the same way we create
other views. Or it may be an undocumented restriction. Lets wait for
Google's clarification on it.
> Hi JuhaK
> Your example gives me an idea and that works!
> Try the following code.
> Then I have a question : MapView is a build-in class and why do we
> have to write it in "class" attribute?
> I assume that "class" attribute is for your own class. The build-in
> class shoud have been written like "TextView".
> Is this a bug?
> ----XML Layout(main.xml)----------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
> android:orientation="vertical" android:layout_width="fill_parent"
> android:layout_height="fill_parent">
> <TextView android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:text="Hello World, JunMap" />
> <EditText android:layout_width="fill_parent"
> android:layout_height="wrap_content" android:layout_weight="1" />
> <view class="com.google.android.maps.MapView"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"/>
> </LinearLayout>
> ------------------------------------
> package com.jun.test;
> import android.os.Bundle;
> import com.google.android.maps.MapView;
> import com.google.android.maps.MapActivity;
> import android.view.Menu;
> public class JunMap extends MapActivity {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle icicle) {
> super.onCreate(icicle);
> setContentView(R.layout.main);
> }
> On Nov 22, 11:12 pm, JuhaK <juha.kervi...@gmail.com> wrote:
> > Hello,
> > This may or may not be relevant to your case of MapViews, but I was
> > getting a similar error when using XML to create EditText view. The
> > view xml was something like this:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <view xmlns:android="http://schemas.android.com/apk/res/android"
> > class="com.mytestmemo.editor.MemoEditor$MemoText"
> > id="@+id/memo"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > android:background="#ffffff"
> > android:padding="10dip"
> > android:scrollbars="vertical"
> > android:fadingEdge="vertical"/>
> > Turned out I had mistyped the name of the inner class (was something
> > like MyMemoText rather than MemoText). The error was also clearly
> > shown in LogCat, where the root cause to the ViewInflate
> > $InflateException was ClassNotFoundException. Does the log show
> > anything informative in your case?
> > BR,
> > JuhaK
> > On 20 marras, 19:09, Farhan <russ...@gmail.com> wrote:
> > > I guess we are missing something regarding creating a MapView by XML
> > > or may be it is not possible. I am waiting for someone from Google to
> > > clarify it.
> > > On Nov 20, 11:01 am, "h.vdhie...@gmail.com" <hie...@tweakers.net>
> > > wrote:
> > > > If someone knows how to create a mapview with xml: let me know! I'm
> > > > can only create a working mapview by creating it directly in the code
> > > > using:
> > > > MapView mv = new MapView(this);
> > > > setContentView(mv);
> > > > On 20 nov, 17:46, Farhan <russ...@gmail.com> wrote:
> > > > > Thanks Prabhu. My intention was to have a MapView with some other view
> > > > > e.g. EditText in a LinearLayout. Though XML is better, as it is the
> > > > > preferred way by Google, doing it programmatically would be fine for
> > > > > me. I just want to combine MapView with something else in one view.
> > > > > On Nov 20, 6:42 am, "prabhu.swaminat...@gmail.com"
> > > > > <prabhu.swaminat...@gmail.com> wrote:
> > > > > > I havent tried thru Layout XML but did with coding.
> > > > > > Just create an instance of MapView and pass it to setCOntentView
> > > > > > MapView mapView = new MapView(this);
> > > > > > MapController mc = mapView.getController();
> > > > > > mc.animateTo(p);
> > > > > > mc.zoomTo(9);
> > > > > > setContentView(mapView);
> > > > > > On Nov 20, 10:43 am, Farhan <russ...@gmail.com> wrote:
> > > > > > > I am trying to use MapView in a MapActivity. My view only has an
> > > > > > > EditText and a MapView. But I am getting the following error while
> > > > > > > trying to run it:
> > > > > > > Binary XML line #13: Error inflating class MapView
> > > > > > > Here is my XML layout file main.xml:
> > > > > > > <?xml version="1.0" encoding="utf-8"?>
> > > > > > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > > > > > > android"
> > > > > > > android:orientation="vertical"
> > > > > > > android:layout_width="fill_parent"
> > > > > > > android:layout_height="fill_parent"
> > > > > > > <EditText id="@+id/location"
> > > > > > > android:layout_width="fill_parent"
> > > > > > > android:layout_height="wrap_content"
> > > > > > > android:text="Enter the location here"
> > > > > > > android:selectAllOnFocus="true"
> > > > > > > />
> > > > > > > <MapView id="@+id/mapv"
> > > > > > > android:layout_width="fill_parent"
> > > > > > > android:layout_height="fill_parent"
> > > > > > > />
> > > > > > > </LinearLayout>
> > > > > > > Here is my only code file:
> > > > > > > package com.russoue.testandroid;
> > > > > > > import android.os.Bundle;
> > > > > > > import android.widget.EditText;
> > > > > > > import com.google.android.maps.MapActivity;
> > > > > > > public class TestAndroid extends MapActivity {
> > > > > > > /** Called when the activity is first created. */
> > > > > > > @Override
> > > > > > > public void onCreate(Bundle icicle) {
> > > > > > > super.onCreate(icicle);
> > > > > > > setContentView(R.layout.main);
> > > > > > > EditText locationField = (EditText)
> > > > > > > findViewById(R.id.location);
> > > > > > > locationField.setSelection(0,
> > > > > > > locationField.getText().length());
> > > > > > > }
> > > > > > > }
> > > > > > > Can anyone help?- Tekst uit oorspronkelijk bericht niet weergeven -
> > > > > - Tekst uit oorspronkelijk bericht weergeven -- Hide quoted text -
> > - Show quoted text -