Hi all, How do I that when every GeoPoint displays a description ? can someone help me?
On 29 set, 21:11, Prash <[EMAIL PROTECTED]> wrote: > Thanks Peter for the post! I was lost with getting a basic Map display > - turns out its an issue with the "uses-permission" in the > AndroidManifest.xml file which seems to be a fairly new development. > > In the Location based API documentation, it would help if they add the > fact that these permissions should be setup before you can do > something useful. > > - Prash > > On Sep 29, 2:21 am, Peter Stevenson <[EMAIL PROTECTED]> wrote: > > > Peter Wrote > > hope this help if not email me again and I see if I can help > > Also add a screen shot > > > You should be able to load data on to your map based on this code > > use a dbHelper Class to help with database control > > > Peter > > > package com.cyberspace.testing.out; > > > import android.graphics.Canvas; > > import android.graphics.drawable.Drawable; > > > import java.io.DataOutputStream; > > import java.io.OutputStream; > > import java.lang.reflect.Array; > > import java.net.HttpURLConnection; > > import java.net.URL; > > import java.util.Vector; > > import org.apache.http.protocol.HTTP; > > import android.os.Bundle; > > import android.view.*; > > import com.google.android.maps.GeoPoint; > > import com.google.android.maps.MapActivity; > > import com.google.android.maps.MapView; > > > public class prueba extends MapActivity { > > > WhereAmIOverlayWhereAmIOverlay; > > View zoomView; > > Drawable defaultMarker; > > MapView map; > > > GeoPoint Point = new GeoPoint((int) (-1.416402 * 1000000), (int) > > (-78.025078 * 1000000)); > > > GeoPoint Point1 = new GeoPoint((int) (-1.616402 * 1000000), (int) > > (-78.025078 * 1000000)); > > GeoPoint Point2 = new GeoPoint((int) (-1.516402 * 1000000), (int) > > (-78.025078 * 1000000)); > > GeoPoint Point3 = new GeoPoint((int) (-1.716402 * 1000000), (int) > > (-78.025078 * 1000000)); > > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > map = (MapView) findViewById(R.id.map); > > defaultMarker = > > getResources().getDrawable(R.drawable.mappin_red); > > defaultMarker.setBounds(0, > > 0,defaultMarker.getIntrinsicWidth(), defaultMarker.getIntrinsicHeight()); > > > // map.getController().setCenter(Point); > > // map.getController().animateTo(Point); > > // map.displayZoomControls(false); > > // map.getController().setZoom(7); > > } > > public boolean onKeyDown(int keyCode, KeyEvent event) { > > switch(keyCode){ > > case KeyEvent.KEYCODE_I: > > int level = map.getZoomLevel(); > > map.getController().setZoom(level + 1); > > return true; > > case KeyEvent.KEYCODE_O: > > int level2 = map.getZoomLevel(); > > map.getController().setZoom(level2 + 1); > > return true; > > case KeyEvent.KEYCODE_S: > > map.setSatellite(true); > > return true; > > case KeyEvent.KEYCODE_T: > > map.setSatellite(false); > > return true; > > } > > return false; > > } > > > @Override > > public boolean onCreateOptionsMenu(Menu menu) { > > super.onCreateOptionsMenu(menu); > > menu.add(0,1,2, "My Location"); > > //menu 1 > > SubMenu sub1 = menu.addSubMenu(3, 2, 3,"Vistas"); > > sub1.add(3,3,1, "Satelite"); > > sub1.add(3,4,2, "Trafico"); > > //menu 2 > > SubMenu sub = menu.addSubMenu(2, 5, 1,"Zoom"); > > sub.add(2,6,1, "In"); > > sub.add(2,7,2, "Out"); > > return true; > > } > > @Override > > public boolean onMenuItemSelected(int featureId, MenuItem item) { > > super.onMenuItemSelected(featureId, item); > > switch (item.getItemId()) { > > case 1: > > WhereAmIOverlay= newWhereAmIOverlay(this,defaultMarker); > > map.getController().animateTo(Point); > > map.getOverlays().add(WhereAmIOverlay); > > zoomView = map.getZoomControls(); > > zoomView.setLayoutParams(new ViewGroup.LayoutParams > > (ViewGroup.LayoutParams.WRAP_CONTENT, > > ViewGroup.LayoutParams.WRAP_CONTENT)); > > map.addView(zoomView); > > map.displayZoomControls(true); > > map.getController().setZoom(10); > > map.setClickable(true); > > map.setEnabled(true); > > map.invalidate(); > > return true; > > case 3: > > map.setSatellite(true); > > return true; > > case 4: > > map.setSatellite(false); > > return true; > > case 6: > > int level = map.getZoomLevel(); > > map.getController().setZoom(level + 1); > > return true; > > case 7: > > int level1 = map.getZoomLevel(); > > map.getController().setZoom(level1 - 1); > > return true; > > } > > return super.onOptionsItemSelected(item);} > > > @Override > > protected boolean isRouteDisplayed() { > > // TODO Auto-generated method stub > > return false; > > }} > > > *or this way > > > * public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > map = (MapView) findViewById(R.id.map); > > defaultMarker = > > getResources().getDrawable(R.drawable.mappin_red); > > defaultMarker.setBounds(0, > > 0,defaultMarker.getIntrinsicWidth(), defaultMarker.getIntrinsicHeight()); > > > WhereAmIOverlay= newWhereAmIOverlay(this,defaultMarker); > > map.getController().animateTo(Point); > > map.getOverlays().add(WhereAmIOverlay); > > zoomView = map.getZoomControls(); > > zoomView.setLayoutParams(new ViewGroup.LayoutParams > > (ViewGroup.LayoutParams.WRAP_CONTENT, > > ViewGroup.LayoutParams.WRAP_CONTENT)); > > map.addView(zoomView); > > map.displayZoomControls(true); > > map.getController().setZoom(10); > > map.setClickable(true); > > map.setEnabled(true); > > map.invalidate(); > > > package com.cyberspace.testing.out; > > > import java.util.ArrayList; > > import java.util.List; > > import android.graphics.*; > > import android.graphics.drawable.Drawable; > > import com.google.android.maps.*; > > > public classWhereAmIOverlayextends ItemizedOverlay< OverlayItem>{ > > > private List<OverlayItem> mItemList = new ArrayList<OverlayItem>(); > > prueba prueba; > > GeoPoint geoPoint; > > Drawable marker; > > private Projection p; > > Point point; > > Paint paint; > > > publicWhereAmIOverlay(prueba prueba,Drawable defaultMarker) { > > super(defaultMarker); > > this.prueba = prueba; > > paint = new Paint(); > > mItemList.add(new OverlayItem(prueba.Point , "Title","Snippet")); > > mItemList.add(new OverlayItem(prueba.Point1 , "This point > > one","Snippet")); > > mItemList.add(new OverlayItem(prueba.Point2 , "Title","Snippet")); > > mItemList.add(new OverlayItem(prueba.Point3 , "Title","Snippet")); > > populate(); > > > } > > > @Override > > protected OverlayItem createItem(int i) { > > return mItemList.get(i); > > } > > @Override > > public int size() { > > return mItemList.size(); > > } > > > } > > > <?xml version="1.0" encoding="utf-8"?> > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > > package="com.cyberspace.testing.out" android:versionCode="1" > > android:versionName="1.0.0"> > > <uses-permission > > android:name="android.permission.ACCESS_COARSE_LOCATION" /> > > <uses-permission android:name="android.permission.INTERNET" /> > > <uses-permission android:name="android.permission.ACCESS_GPS" /> > > <uses-permission android:name="android.permission.ACCESS_LOCATION" /> > > <uses-permission > > android:name="android.permission.ACCESS_ASSISTED_GPS" /> > > <uses-permission android:name="android.permission.ACCESS_CELL_ID" /> > > <application android:icon="@drawable/icon" > > android:label="@string/app_name"> > > <uses-library android:name="com.google.android.maps" /> > > <activity android:name=".prueba" android:label="@string/app_name"> > > <intent-filter> > > <action android:name="android.intent.action.MAIN" /> > > <category android:name="android.intent.category.LAUNCHER" /> > > </intent-filter> > > </activity> > > </application> > > </manifest> > > > Screenshot-Android Emulator (5554).png > > 139KViewDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---