开发者

having problem to connect internet in android

I am trying to access google map in a specific point in a android activity. My emulator is connected with internet. I also give internet permission to manifest.xml file. But my program can not connect to internet. Only show grid lines but no map. I can't find any error .Please help me out.here is my code

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mv=(MapView)findViewById(R.id.mapView);

    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
    View zoomView = mv.getZoomControls(); 

    zoomLayout.addView(zoomView, 
        new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, 
            LayoutParams.WRAP_CONTENT)); 
    mv.displayZoomControls(true);


    mc=mv.getController();
    String coordinates[] = {"1.352566007", "103.78921587"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p=new GeoPoint((int)(lat*1E6),(int)(lng*1E6));
    mc.animateTo(p);
    mc.setZoom(17); 
    mv.invalidate();

My manifest.xml

<?xml version="1.0" encoding="utf-8"?>

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <uses-library android:name="com.google.andro开发者_如何学编程id.maps"></uses-library>
    <activity android:name=".geo_loc"
              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>


You most likely need a Maps API key. If you think you already have a Maps API key and still can't figure it out, post your manifest .xml file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜