launching map on click of a button

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

launching map on click of a button

Postby schofeild » Thu Feb 17, 2011 7:34 am

hey guys i have been trying to launch a map on click of a button...but the button does not appear at all...i directly get the map view...can someone help me plzzz

import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.*;
import android.view.*;
import android.widget.*;

public class Mapb extends MapActivity
{
private MapView mapView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button bt=(Button)findViewById(R.id.bt);
bt.setOnClickListener(new View.OnClickListener()
{public void onClick(View v)
{mapView = (MapView) findViewById(R.id.mapview);}
});


}

protected boolean isRouteDisplayed()
{
// TODO Auto-generated method stub
return false;
}
}
schofeild
Developer
Developer
 
Posts: 40
Joined: Wed Jul 21, 2010 12:08 pm

Top

Re: launching map on click of a button

Postby JoxTraex » Sat Feb 19, 2011 12:47 am

You're definitely missing a couple of steps!

http://developer.android.com/guide/tuto ... pview.html

and make sure the mapview of your key has a valid key.
JoxTraex
Developer
Developer
 
Posts: 25
Joined: Wed Jan 26, 2011 12:29 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 1 guest