MapView not work in SDK 1.0!

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

MapView not work in SDK 1.0!

Postby phannguyen » Fri Oct 03, 2008 9:54 am

hi all,
i have a problem with mapview. In old version mapview work well, but in SDK 1.0 mapview not work.
Now with SDk 1.0 mapview not show,not toggle for satellite, it's only blank screen.
This is mycode:

basicmap.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.google.android.example;
  2.  
  3.  
  4.  
  5. import android.app.Activity;
  6.  
  7. import android.os.Bundle;
  8.  
  9. import android.view.KeyEvent;
  10.  
  11.  
  12.  
  13. import com.google.android.maps.GeoPoint;
  14.  
  15. import com.google.android.maps.MapActivity;
  16.  
  17. import com.google.android.maps.MapController;
  18.  
  19. import com.google.android.maps.MapView;
  20.  
  21. import android.graphics.Point;
  22.  
  23. public class BasicMap extends MapActivity {
  24.  
  25.         private MapView myMapView;
  26.  
  27.  
  28.  
  29.     @Override
  30.  
  31.     public void onCreate(Bundle icicle) {
  32.  
  33.         super.onCreate(icicle);
  34.  
  35.         myMapView = new MapView(this, "key?");
  36.  
  37.  
  38.  
  39.         // Lets start at the Statue of Liberty
  40.  
  41.         // I grabbed the data from Google-Maps
  42.  
  43.         GeoPoint p = new GeoPoint((int) (40.689213 * 1000000),
  44.  
  45.                               (int) (-74.044558 * 1000000));
  46.  
  47.         // Get the controller, that is used for translation and zooming
  48.  
  49.         MapController mc = myMapView.getController();
  50.  
  51.         // Translate to the Statue of Liberty
  52.  
  53.         mc.animateTo(p);
  54.  
  55.         // Zoom Very close
  56.  
  57.         mc.setZoom(21);
  58.  
  59.         // Make myMapView the exilicit view of this app
  60.  
  61.         setContentView(myMapView);
  62.  
  63.         // Enable Sattelite-Mode, so we will se the
  64.  
  65.         // Statue of liberty instantly on the screen
  66.  
  67.         myMapView.setSatellite(true);
  68.  
  69.     }
  70.  
  71.  
  72.  
  73.     public boolean onKeyDown(int keyCode, KeyEvent event) {
  74.  
  75.         if (keyCode == KeyEvent.KEYCODE_I) {
  76.  
  77.             // Zooming In
  78.  
  79.             myMapView.getController().zoomIn();
  80.  
  81.             return true;
  82.  
  83.         } else if (keyCode == KeyEvent.KEYCODE_O) {
  84.  
  85.             // Zooming Out
  86.  
  87.             myMapView.getController().zoomOut();
  88.  
  89.             return true;
  90.  
  91.         } else if (keyCode == KeyEvent.KEYCODE_S) {
  92.  
  93.           // Switch to satellite view
  94.  
  95.           myMapView.setSatellite(true);;
  96.  
  97.             return true;
  98.  
  99.         } else if (keyCode == KeyEvent.KEYCODE_T) {
  100.  
  101.             // Switch on traffic overlays
  102.  
  103.             myMapView.setTraffic(true);
  104.  
  105.             return true;
  106.  
  107.         }
  108.  
  109.         return false;
  110.  
  111.     }
  112.  
  113.  
  114.  
  115.      @Override
  116.  
  117.      protected boolean isRouteDisplayed() {
  118.  
  119.           // TODO Auto-generated method stub
  120.  
  121.           return false;
  122.  
  123.      }
  124.  
  125. }
Parsed in 0.039 seconds, using GeSHi 1.0.8.4


my Manifest.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.      package="com.google.android.example"
  6.  
  7.      android:versionCode="1"
  8.  
  9.      android:versionName="1.0.0">
  10.  
  11.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  12.  
  13.     <uses-library android:name="com.google.android.maps"/>
  14.  
  15.     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  16.  
  17.     <uses-permission android:name="android.permission.INTERNET" />
  18.  
  19.         <activity android:name=".BasicMap"
  20.  
  21.                  android:label="@string/app_name">
  22.  
  23.             <intent-filter>
  24.  
  25.                 <action android:name="android.intent.action.MAIN" />
  26.  
  27.                 <category android:name="android.intent.category.LAUNCHER" />
  28.  
  29.             </intent-filter>
  30.  
  31.         </activity>
  32.  
  33.     </application>
  34.  
  35. </manifest>
  36.  
  37.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


what wrong here?please help me.
thanks a lot.
Attachments
map_error.JPG
map_error.JPG (44.29 KiB) Viewed 379 times
PhanNguyen
phannguyen
Experienced Developer
Experienced Developer
 
Posts: 56
Joined: Thu Jul 17, 2008 7:37 am

Top

Postby ninor » Fri Oct 03, 2008 12:10 pm

Your code doesn't show any map...
(I tested it too)

Check this out: http://www.anddev.org/simple_googlemaps_with_threads-t2943.html
Image AndDev: Your Android Development Community / Tutorials | Here's my Basic ToolKit
User avatar
ninor
Moderator
Moderator
 
Posts: 180
Joined: Thu Aug 14, 2008 6:30 pm
Location: Barcelona, Spain

Postby Marchu » Sat Oct 04, 2008 10:28 pm

Hello,

See the reply in the original post (basic map application) in map tutorials, for a solution.
(A blank map is almost always a permission problem)

Cheers
Marchu
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Sep 27, 2008 4:11 pm
Location: Netherlands

Postby phannguyen » Mon Oct 06, 2008 3:28 am

thanks for your help,
if anyone got same problem,please check here to found solution
http://www.anddev.org/viewtopic.php?p=10965#10965
best regard,
PhanNguyen
phannguyen
Experienced Developer
Experienced Developer
 
Posts: 56
Joined: Thu Jul 17, 2008 7:37 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 6 guests