2011-11-22 31 views
0

這是我的代碼。我試過這段代碼,但是在MapActivity,MapView和其他位置有錯誤。而當我把光標放在那裏時,我寫這段代碼,它不顯示導入選項......我不知道爲什麼。與此代碼的方法並不here..check導入它PLZ任何一個嘗試我沒有得到MapView和任何一個確切的位置幫助我嗎?

package com.bened; 

import android.os.Bundle; 

public class mapExactDemoActivity extends MapActivity { 
    /** Called when the activity is first created. */ 
    MapView mv; 
    double lat=17.441966,lon=78.445127; 
    GeoPoint gp; 
    MapController mc; 

    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     mv=(MapView)findViewById(R.id.map); 
     gp=new GeoPoint((int)(lat*1000000),(int)(lon*1000000)); 
     mc=mv.getController(); 
     mc.setCenter(gp); 
     mc.setZoom(20); 
     mv.setBuiltInZoomControls(true); 

    } 

    @Override 
    protected boolean isRouteDisplayed() { 
     // TODO Auto-generated method stub 
     return false; 
    } 
} 

佈局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <com.google.android.maps.MapView 
    android:id="@+id/map" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:apiKey="00S4pru3FgTKZjOlX2agvv2TBWx5p3sVbOvgiAw" 
    android:clickable="true" 
    /> 
</LinearLayout> 

3.LogCat錯誤的詳細信息

11-23 12:02:03.946: D/PackageParser(68): Scanning package: /data/app/vmdl-1317076106.tmp 
11-23 12:02:04.084: D/PackageManager(68): Scanning package com.bened 
11-23 12:02:04.084: E/PackageManager(68): Package com.bened requires unavailable shared library com.google.android.maps; failing! 
11-23 12:02:04.084: W/PackageManager(68): Package couldn't be installed in /data/app/com.bened-1.apk 
11-23 12:02:04.234: D/dalvikvm(68): GC_EXPLICIT freed 580K, 49% free 4250K/8263K, external 4768K/5461K, paused 138ms 
11-23 12:02:04.374: D/AndroidRuntime(360): Shutting down VM 
11-23 12:02:04.384: D/dalvikvm(360): GC_CONCURRENT freed 213K, 71% free 302K/1024K, external 0K/0K, paused 2ms+1ms 
11-23 12:02:04.394: D/dalvikvm(360): Debugger has detached; object registry had 1 entries 
11-23 12:02:04.414: I/AndroidRuntime(360): NOTE: attach of thread 'Binder Thread #3' failed 
11-23 12:02:33.943: D/SntpClient(68): request time failed: java.net.SocketException: Address family not supported by protocol 
11-23 12:07:33.973: D/SntpClient(68): request time failed: java.net.SocketException: Address family not supported by protocol 
11-23 12:07:52.414: D/AndroidRuntime(376): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 
11-23 12:07:52.414: D/AndroidRuntime(376): CheckJNI is ON 
11-23 12:07:53.496: D/AndroidRuntime(376): Calling main entry com.android.commands.pm.Pm 
11-23 12:07:53.764: D/dalvikvm(236): GC_EXPLICIT freed 10K, 54% free 2546K/5511K, external 1625K/2137K, paused 88ms 
11-23 12:07:53.787: W/ActivityManager(68): No content provider found for: 
11-23 12:07:53.814: W/ActivityManager(68): No content provider found for: 
11-23 12:07:53.864: D/PackageParser(68): Scanning package: /data/app/vmdl-257441530.tmp 
11-23 12:07:54.024: D/PackageManager(68): Scanning package com.bened 
11-23 12:07:54.024: E/PackageManager(68): Package com.bened requires unavailable shared library com.google.android.maps; failing! 
11-23 12:07:54.024: W/PackageManager(68): Package couldn't be installed in /data/app/com.bened-1.apk 
11-23 12:07:54.184: D/dalvikvm(68): GC_EXPLICIT freed 250K, 49% free 4229K/8263K, external 3511K/4385K, paused 138ms 
11-23 12:07:54.296: D/AndroidRuntime(376): Shutting down VM 
11-23 12:07:54.325: I/AndroidRuntime(376): NOTE: attach of thread 'Binder Thread #3' failed 
11-23 12:07:54.334: D/dalvikvm(376): GC_CONCURRENT freed 213K, 71% free 302K/1024K, external 0K/0K, paused 2ms+4ms 
11-23 12:07:54.334: D/jdwp(376): Got wake-up signal, bailing out of select 
11-23 12:07:54.334: D/dalvikvm(376): Debugger has detached; object registry had 1 entries 
+1

您可以添加logcat嗎? – aNi

+1

請編輯您的問題並插入您收到的錯誤(例外?)。這將幫助其他用戶瞭解您的問題。 – oers

+1

我試圖通過修正語法來解決你的問題,但我無法弄清楚你的意思是「如果我把光標放在那裏,它不會導入選項」。你能改述一下嗎? –

回答

0

它不店鋪進口選項

如果這是說:「不解決您的進口」

根本就本組織您的進口奇怪的是:按Ctrl + + Ø

如果這不起作用, setup your project properly

0

請檢查您是否使用過Google API(Google Inc.)的Sdk模擬器2.2或任何升級版本。

相關問題