The place name in maps automatically

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

The place name in maps automatically

Postby dkkundudolan » Thu Mar 13, 2008 2:12 pm

Hi,
I want to pass the place name in maps which will find the place automatically. i had done for the map design in the following way.


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package org.me.mapping;
  2.  
  3.  
  4.  
  5. //import android.graphics.Point;
  6.  
  7. import com.google.android.maps.Point;
  8.  
  9. import android.os.Bundle;
  10.  
  11. import android.view.KeyEvent;
  12.  
  13. import com.google.android.maps.MapActivity;
  14.  
  15. import com.google.android.maps.MapController;
  16.  
  17. import com.google.android.maps.MapView;
  18.  
  19.  
  20.  
  21. public class Mapping extends MapActivity {
  22.  
  23.         Point p;
  24.  
  25.         Point p1;
  26.  
  27.         // Address add[];
  28.  
  29.         private MapView myMapView;
  30.  
  31.  
  32.  
  33.    
  34.  
  35.     public void onCreate(Bundle icicle) {
  36.  
  37.         super.onCreate(icicle);
  38.  
  39.         myMapView = new MapView(this);
  40.  
  41.  
  42.  
  43.        
  44.  
  45.        
  46.  
  47.          p = new Point((int) (40.689213 * 1000000),
  48.  
  49.                               (int) (91.044558 * 1000000));
  50.  
  51.         //Point p1 = new Point((int) (34.4164*1000000), (int) (70.025078 * 1000000 ));
  52.  
  53.        
  54.  
  55.         MapController mc = myMapView.getController();
  56.  
  57.        
  58.  
  59.         mc.animateTo(p);
  60.  
  61.        
  62.  
  63.        
  64.  
  65.        mc.zoomTo(5);
  66.  
  67.        
  68.  
  69.        /* setContentView(R.layout.main);
  70.  
  71.         EditText locationField = (EditText) findViewById(R.id.location);
  72.  
  73.         locationField.setSelection(0, locationField.getText().length());
  74.  
  75.         */
  76.  
  77.         setContentView(myMapView);
  78.  
  79.  
  80.  
  81.        
  82.  
  83.        
  84.  
  85.        // myMapView.toggleSatellite();
  86.  
  87.     }
  88.  
  89.  
  90.  
  91.     public boolean onKeyDown(int keyCode, KeyEvent event) {
  92.  
  93.         if (keyCode == KeyEvent.KEYCODE_I) {
  94.  
  95.            
  96.  
  97.             myMapView.getController().zoomTo(myMapView.getZoomLevel() + 1);
  98.  
  99.            return true;
  100.  
  101.         } else if (keyCode == KeyEvent.KEYCODE_O) {
  102.  
  103.            
  104.  
  105.             myMapView.getController().zoomTo(myMapView.getZoomLevel() - 1);
  106.  
  107.             return true;
  108.  
  109.         } else
  110.  
  111.                 if (keyCode == KeyEvent.KEYCODE_S) {
  112.  
  113.          
  114.  
  115.             myMapView.toggleSatellite();
  116.  
  117.             return true;
  118.  
  119.         } else if (keyCode == KeyEvent.KEYCODE_T) {
  120.  
  121.            
  122.  
  123.             myMapView.toggleTraffic();
  124.  
  125.             return true;
  126.  
  127.         }
  128.  
  129.         return false;
  130.  
  131.     }
  132.  
  133. }
  134.  
  135.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


in this i want to give the place name which will the place name automatically.

Thanks,
Dolan.
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Top

Postby plusminus » Thu May 22, 2008 11:14 am

Hello dkkundudolan,

you want to center the map to sth you typed to the EditText :?:

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 buster » Wed Jun 11, 2008 12:50 pm

I guess he wants to.
Question on my side:
googlemaps lets me search for points of interest (restaurants, and such).
Is there any similar thing on android?
How would you achieve this?
In some other tutorial someone is using yahoo for this, why? :o
buster
Junior Developer
Junior Developer
 
Posts: 23
Joined: Tue Apr 22, 2008 4:14 pm
Location: Berlin, Germany

Postby plusminus » Thu Jun 12, 2008 1:47 pm

Hello buster,

buster wrote:Is there any similar thing on android?
How would you achieve this?
In some other tutorial someone is using yahoo for this, why? :o


The since m5 existing GeoCode could do this. (At least it would, but it currently is a fake-implementation, which is querying the database)

Using Yahoo had been done, because the Android-Geocoder was not available at all.

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

Top

Return to Map Problems

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests