以下源代码没有被执行......我正在学习如何处理谷歌地图..请帮助
这是我的源代码::
package com.example.maptest;
import android.os.Bundle;
import android.location.*;
import android.content.Context;
import android.view.Menu;
import com.google.android.maps.*;
public class MainActivity extends MapActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context context = getApplicationContext();
LocationManager locationManager =
(LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
Location location = null;
double lat = location.getLatitude() * 100000;
double longi = location.getLongitude() * 100000;
LocationProvider provider =
locationManager.getProvider(LocationManager.NETWORK_PROVIDER);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
这是 XML 文件
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0GH71P-8YZB_XmnfIDs_-NOCtdlku2nwKABE61Q"
/>
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:ems="10"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
</RelativeLayout>
我的 AndroidManifest 是::
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.maptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.maptest.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
我真的很困惑为什么它没有开始......请帮助
03-17 08:34:05.215: W/dalvikvm(2380): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
03-17 08:34:05.235: E/AndroidRuntime(2380): FATAL EXCEPTION: main
03-17 08:34:05.235: E/AndroidRuntime(2380): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.maptest/com.example.maptest.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.maptest.MainActivity" on path: /data/app/com.example.maptest-2.apk
03-17 08:34:05.235: E/AndroidRuntime(2380): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:210)