problem with maps

Put your problem here if it does not fit any of the other categories.

problem with maps

Postby bins1984 » Thu Feb 21, 2008 11:25 am

i tried to use simple map tutorial its working but it still showing some error.......but my exact problem is i need make one tool bar and i need to display along with the map in bottom of the screen...so i created the tool bar in x ml......but how to display both together......or how to make tool bar as an overlay of the map///...........if any body knows please help me........ :(
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

Top

Postby plusminus » Thu Feb 21, 2008 4:27 pm

Hello bins,

you can put controls above a map using a RelativeLayout, like this:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.         android:layout_width="fill_parent"
  4.         android:layout_height="fill_parent">    
  5.         <view class="com.google.android.maps.MapView"
  6.                 android:id="@+id/map_whereami"
  7.                 android:layout_width="fill_parent"
  8.                 android:layout_height="fill_parent"/>
  9.         <ImageButton
  10.                 android:id="@+id/ibtn_whereami_center"
  11.                 android:layout_width="wrap_content"
  12.                 android:layout_height="wrap_content"
  13.                 android:layout_above="@+id/ibtn_whereami_whereami"
  14.                 android:layout_alignParentBottom="true"
  15.                 android:layout_alignParentRight="true"
  16.                 android:src="@drawable/person_32"/>
  17. </RelativeLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


The result is similar to:
Image


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby don » Thu Feb 21, 2008 5:01 pm

I am having the same issue. Before the new SDK, my app had a tool bar on the bottom of the screen and the map on the top. However, I can't get them to work anymore, so I tried the example you posted. I get an error inflating the binary XML with the layout XML posted above. Is there something I am missing?

One question that could be the whole issue: I am trying to open the map screen as a new view, not a new activity. Does that work or does it need to be its own mapActivity? As I type this it is become apparent that it probably does have to be a new activity and not just a view, but I am posting anyway in case I am wrong! Or someone else is having this issue.

Thanks for any help.

PS: Your example app looks very good +/- !
don
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Dec 07, 2007 5:17 am

Postby plusminus » Thu Feb 21, 2008 5:28 pm

Hello don,

the MapActivity Base class with code to manage the boring necessities of any activity that displays a MapView, like:

* Activity lifecycle management
* Setup and teardown of services behind a MapView

A subclass should create its own MapView in onCreate(...).


The xml-code should be fine, I only deleted some additional buttons. If it still occurs afterwards, perhaps give us the line where the InflateException happens :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby don » Thu Feb 21, 2008 5:31 pm

Will do, thanks for the help, I guess I was trying to get too fancy :(
don
Junior Developer
Junior Developer
 
Posts: 18
Joined: Fri Dec 07, 2007 5:17 am

Postby bins1984 » Fri Feb 22, 2008 6:02 am

thanks man............................ :D
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

Top

Postby bins1984 » Wed Feb 27, 2008 10:23 am

HI plus minus.......i tried u r code ........now i am using the "SDK M5" before it was M3.....so now i am getting the error in the emulator that its showing that java.lan.NUllpointerException
Image
any change i have to make in this file to run in M5..........Manifesto.xml i changed....but still error is showing.....
please give me some guidelines.........
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

I am getting the same

Postby rahul_mawkins » Mon Mar 10, 2008 3:43 pm

I have a Tabhost with one of the tab having a mapview
Even I made whole Activity as MapView but its showing error
The same nullpointer exception

Did you happen to solve this problem

Please help
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

solved[] solved my own problem(acidently)

Postby rahul_mawkins » Mon Mar 10, 2008 4:05 pm

using
[syntax="java"]
ts1.setIndicator("Using Current Location");
ts1.setContent(new TabHost.TabContentFactory(){
public View createTabContent(String tag)
{
MapView mv=(MapView)AddNewLocationBookmark.this.findViewById(R.id.current_location_map);
return mv;
}
});
now it works
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

MapActivity in TabActivity

Postby matany » Sat Dec 19, 2009 3:12 am

Hi Plusminus,

Thanks for a wonderful site.

Please help me here. I have four tabs in one TabActivity with main.xml and I also have one MapActivity with its own main.xml file. I would like to show the MapActivity class in one of the Tabs, like Tab3.

I tried intents etc, no luck.

What am I doing wrong...

Please help

Thanks

Y
matany
Experienced Developer
Experienced Developer
 
Posts: 66
Joined: Tue Dec 08, 2009 9:29 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests