I am trying to add infowindows to markers/pushpins on the map. ATM, it is not working. It makes the app force cloce. Here is the code for the tabhost, maps and overlays(i am including the webview aswell, but only because it may be causing the problem)
Current code(Tabhost, maps:
TravelBuddy.java/TabHost
MapTabView.java/Map:
Current code(Tabhost, maps:
TravelBuddy.java/TabHost
Code:
package com.jappapps.android.travelbuddy;
import java.util.List;
import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import com.google.android.maps.Overlay;
public class TravelBuddy extends TabActivity {
TabHost mTabHost;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Context ctx = this.getApplicationContext();
//tab 1
mTabHost = getTabHost();
TabSpec tabSpec1 = mTabHost.newTabSpec("Maps");
tabSpec1.setIndicator("Map");
Intent i1 = new Intent(ctx, MapTabView.class);
tabSpec1.setContent(i1);
mTabHost.addTab(tabSpec1);
//tab2
mTabHost = getTabHost();
TabSpec tabSpec2 = mTabHost.newTabSpec("Web");
tabSpec2.setIndicator("Featured");
Intent i2 = new Intent(ctx, WebView1.class);
tabSpec2.setContent(i2);
mTabHost.addTab(tabSpec2);
/*
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
Overlays itemizedoverlay = new Overlays(drawable);*/
}
}
MapTabView.java/Map:
Code:
package com.jappapps.android.travelbuddy;
import java.util.List;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
public class MapTabView extends MapActivity {
MapController mapController;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maptabview);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
Overlays1 itemizedoverlay = new Overlays1(drawable);
GeoPoint un = new GeoPoint((int) (59.911868847598406*1E6), (int) (10.73362112045288*1E6));
OverlayItem overlayitem = new OverlayItem(un, "Oslo R