我创建了显示谷歌地图的课程,但我想先让课程开始 当我按下这个班级按钮去googlemap班 当我按下此按钮时,应用程序崩溃了 这是我新代码的代码
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class homepage extends MainActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout1);
}
public void onClick(View view) {
startActivity(new Intent("com.example.gmapsapp.MainActivity"));
}
public void onClick1(View view) {
startActivity(new Intent("com.example.gmapsapp.homepage2"));
}
}
这对于包含地图的主要活动
public class MainActivity extends FragmentActivity {
private static final int GPS_ERRORDIALOG_REQUEST = 9001;
GoogleMap mMap;
private static final double NASRCITY_LAT = 30.066108,
NASRCITY_LNG =31.336184;
private static final float DEFAULTZOOM = 13;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (servicesOK()) {
setContentView(R.layout.activity_map);
if (initMap()) {
Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show();
gotoLocation(NASRCITY_LAT, NASRCITY_LNG, DEFAULTZOOM);
}
else {
Toast.makeText(this, "Map not available!", Toast.LENGTH_SHORT).show();
}
}
else {
setContentView(R.layout.activity_main);
}
}
logcat是
03-28 12:40:22.260: E/AndroidRuntime(2579): FATAL EXCEPTION: main
03-28 12:40:22.260: E/AndroidRuntime(2579): Process: com.example.gmapsapp, PID: 2579
03-28 12:40:22.260: E/AndroidRuntime(2579): java.lang.IllegalStateException: Could not execute method of the activity
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.view.View$1.onClick(View.java:3823)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.view.View.performClick(View.java:4438)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.view.View$PerformClick.run(View.java:18422)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.os.Handler.handleCallback(Handler.java:733)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.os.Handler.dispatchMessage(Handler.java:95)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.os.Looper.loop(Looper.java:136)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 12:40:22.260: E/AndroidRuntime(2579): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:40:22.260: E/AndroidRuntime(2579): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:40:22.260: E/AndroidRuntime(2579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 12:40:22.260: E/AndroidRuntime(2579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 12:40:22.260: E/AndroidRuntime(2579): at dalvik.system.NativeStart.main(Native Method)
03-28 12:40:22.260: E/AndroidRuntime(2579): Caused by: java.lang.reflect.InvocationTargetException
03-28 12:40:22.260: E/AndroidRuntime(2579): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:40:22.260: E/AndroidRuntime(2579): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.view.View$1.onClick(View.java:3818)
03-28 12:40:22.260: E/AndroidRuntime(2579): ... 11 more
03-28 12:40:22.260: E/AndroidRuntime(2579): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.gmapsapp.MainActivity }
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.Activity.startActivityForResult(Activity.java:3424)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.Activity.startActivityForResult(Activity.java:3385)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.Activity.startActivity(Activity.java:3627)
03-28 12:40:22.260: E/AndroidRuntime(2579): at android.app.Activity.startActivity(Activity.java:3595)
03-28 12:40:22.260: E/AndroidRuntime(2579): at com.example.gmapsapp.homepage.onClick(homepage.java:15)
03-28 12:40:22.260: E/AndroidRuntime(2579): ... 14 more
03-28 12:40:36.530: E/AndroidRuntime(2638): FATAL EXCEPTION: main
03-28 12:40:36.530: E/AndroidRuntime(2638): Process: com.example.gmapsapp, PID: 2638
03-28 12:40:36.530: E/AndroidRuntime(2638): java.lang.IllegalStateException: Could not execute method of the activity
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.view.View$1.onClick(View.java:3823)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.view.View.performClick(View.java:4438)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.view.View$PerformClick.run(View.java:18422)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.os.Handler.handleCallback(Handler.java:733)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.os.Handler.dispatchMessage(Handler.java:95)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.os.Looper.loop(Looper.java:136)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 12:40:36.530: E/AndroidRuntime(2638): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:40:36.530: E/AndroidRuntime(2638): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:40:36.530: E/AndroidRuntime(2638): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 12:40:36.530: E/AndroidRuntime(2638): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 12:40:36.530: E/AndroidRuntime(2638): at dalvik.system.NativeStart.main(Native Method)
03-28 12:40:36.530: E/AndroidRuntime(2638): Caused by: java.lang.reflect.InvocationTargetException
03-28 12:40:36.530: E/AndroidRuntime(2638): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:40:36.530: E/AndroidRuntime(2638): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.view.View$1.onClick(View.java:3818)
03-28 12:40:36.530: E/AndroidRuntime(2638): ... 11 more
03-28 12:40:36.530: E/AndroidRuntime(2638): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.gmapsapp.homepage2 }
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.Activity.startActivityForResult(Activity.java:3424)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.Activity.startActivityForResult(Activity.java:3385)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.Activity.startActivity(Activity.java:3627)
03-28 12:40:36.530: E/AndroidRuntime(2638): at android.app.Activity.startActivity(Activity.java:3595)
03-28 12:40:36.530: E/AndroidRuntime(2638): at com.example.gmapsapp.homepage.onClick1(homepage.java:18)
03-28 12:40:36.530: E/AndroidRuntime(2638): ... 14 more
03-28 12:45:34.175: E/AndroidRuntime(2714): FATAL EXCEPTION: main
03-28 12:45:34.175: E/AndroidRuntime(2714): Process: com.example.gmapsapp, PID: 2714
03-28 12:45:34.175: E/AndroidRuntime(2714): java.lang.IllegalStateException: Could not execute method of the activity
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.view.View$1.onClick(View.java:3823)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.view.View.performClick(View.java:4438)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.view.View$PerformClick.run(View.java:18422)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.os.Handler.handleCallback(Handler.java:733)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.os.Handler.dispatchMessage(Handler.java:95)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.os.Looper.loop(Looper.java:136)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 12:45:34.175: E/AndroidRuntime(2714): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:45:34.175: E/AndroidRuntime(2714): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:45:34.175: E/AndroidRuntime(2714): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 12:45:34.175: E/AndroidRuntime(2714): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 12:45:34.175: E/AndroidRuntime(2714): at dalvik.system.NativeStart.main(Native Method)
03-28 12:45:34.175: E/AndroidRuntime(2714): Caused by: java.lang.reflect.InvocationTargetException
03-28 12:45:34.175: E/AndroidRuntime(2714): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:45:34.175: E/AndroidRuntime(2714): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.view.View$1.onClick(View.java:3818)
03-28 12:45:34.175: E/AndroidRuntime(2714): ... 11 more
03-28 12:45:34.175: E/AndroidRuntime(2714): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.gmapsapp.MainActivity }
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.Activity.startActivityForResult(Activity.java:3424)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.Activity.startActivityForResult(Activity.java:3385)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.Activity.startActivity(Activity.java:3627)
03-28 12:45:34.175: E/AndroidRuntime(2714): at android.app.Activity.startActivity(Activity.java:3595)
03-28 12:45:34.175: E/AndroidRuntime(2714): at com.example.gmapsapp.homepage.onClick(homepage.java:15)
03-28 12:45:34.175: E/AndroidRuntime(2714): ... 14 more
03-28 12:46:06.655: E/AndroidRuntime(2800): FATAL EXCEPTION: main
03-28 12:46:06.655: E/AndroidRuntime(2800): Process: com.example.gmapsapp, PID: 2800
03-28 12:46:06.655: E/AndroidRuntime(2800): java.lang.IllegalStateException: Could not execute method of the activity
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.view.View$1.onClick(View.java:3823)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.view.View.performClick(View.java:4438)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.view.View$PerformClick.run(View.java:18422)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.os.Handler.handleCallback(Handler.java:733)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.os.Handler.dispatchMessage(Handler.java:95)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.os.Looper.loop(Looper.java:136)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 12:46:06.655: E/AndroidRuntime(2800): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:46:06.655: E/AndroidRuntime(2800): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:46:06.655: E/AndroidRuntime(2800): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 12:46:06.655: E/AndroidRuntime(2800): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 12:46:06.655: E/AndroidRuntime(2800): at dalvik.system.NativeStart.main(Native Method)
03-28 12:46:06.655: E/AndroidRuntime(2800): Caused by: java.lang.reflect.InvocationTargetException
03-28 12:46:06.655: E/AndroidRuntime(2800): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 12:46:06.655: E/AndroidRuntime(2800): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.view.View$1.onClick(View.java:3818)
03-28 12:46:06.655: E/AndroidRuntime(2800): ... 11 more
03-28 12:46:06.655: E/AndroidRuntime(2800): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.gmapsapp.FragmentActivity }
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.Activity.startActivityForResult(Activity.java:3424)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.Activity.startActivityForResult(Activity.java:3385)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.Activity.startActivity(Activity.java:3627)
03-28 12:46:06.655: E/AndroidRuntime(2800): at android.app.Activity.startActivity(Activity.java:3595)
03-28 12:46:06.655: E/AndroidRuntime(2800): at com.example.gmapsapp.homepage.onClick(homepage.java:15)
03-28 12:46:06.655: E/AndroidRuntime(2800): ... 14 more
03-28 13:12:43.609: E/AndroidRuntime(2883): FATAL EXCEPTION: main
03-28 13:12:43.609: E/AndroidRuntime(2883): Process: com.example.gmapsapp, PID: 2883
03-28 13:12:43.609: E/AndroidRuntime(2883): java.lang.IllegalStateException: Could not execute method of the activity
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.view.View$1.onClick(View.java:3823)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.view.View.performClick(View.java:4438)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.view.View$PerformClick.run(View.java:18422)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.os.Handler.handleCallback(Handler.java:733)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.os.Handler.dispatchMessage(Handler.java:95)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.os.Looper.loop(Looper.java:136)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 13:12:43.609: E/AndroidRuntime(2883): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 13:12:43.609: E/AndroidRuntime(2883): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 13:12:43.609: E/AndroidRuntime(2883): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 13:12:43.609: E/AndroidRuntime(2883): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 13:12:43.609: E/AndroidRuntime(2883): at dalvik.system.NativeStart.main(Native Method)
03-28 13:12:43.609: E/AndroidRuntime(2883): Caused by: java.lang.reflect.InvocationTargetException
03-28 13:12:43.609: E/AndroidRuntime(2883): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 13:12:43.609: E/AndroidRuntime(2883): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.view.View$1.onClick(View.java:3818)
03-28 13:12:43.609: E/AndroidRuntime(2883): ... 11 more
03-28 13:12:43.609: E/AndroidRuntime(2883): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.gmapsapp.MainActivity }
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.Activity.startActivityForResult(Activity.java:3424)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.Activity.startActivityForResult(Activity.java:3385)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.Activity.startActivity(Activity.java:3627)
03-28 13:12:43.609: E/AndroidRuntime(2883): at android.app.Activity.startActivity(Activity.java:3595)
03-28 13:12:43.609: E/AndroidRuntime(2883): at com.example.gmapsapp.homepage.onClick(homepage.java:15)
03-28 13:12:43.609: E/AndroidRuntime(2883): ... 14 more
03-28 13:24:29.900: E/AndroidRuntime(2947): FATAL EXCEPTION: main
03-28 13:24:29.900: E/AndroidRuntime(2947): Process: com.example.gmapsapp, PID: 2947
03-28 13:24:29.900: E/AndroidRuntime(2947): java.lang.IllegalStateException: Could not execute method of the activity
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.view.View$1.onClick(View.java:3823)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.view.View.performClick(View.java:4438)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.view.View$PerformClick.run(View.java:18422)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.os.Handler.handleCallback(Handler.java:733)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.os.Handler.dispatchMessage(Handler.java:95)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.os.Looper.loop(Looper.java:136)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-28 13:24:29.900: E/AndroidRuntime(2947): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 13:24:29.900: E/AndroidRuntime(2947): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 13:24:29.900: E/AndroidRuntime(2947): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-28 13:24:29.900: E/AndroidRuntime(2947): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-28 13:24:29.900: E/AndroidRuntime(2947): at dalvik.system.NativeStart.main(Native Method)
03-28 13:24:29.900: E/AndroidRuntime(2947): Caused by: java.lang.reflect.InvocationTargetException
03-28 13:24:29.900: E/AndroidRuntime(2947): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 13:24:29.900: E/AndroidRuntime(2947): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.view.View$1.onClick(View.java:3818)
03-28 13:24:29.900: E/AndroidRuntime(2947): ... 11 more
03-28 13:24:29.900: E/AndroidRuntime(2947): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.gmapsapp.MainActivity }
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.Activity.startActivityForResult(Activity.java:3424)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.Activity.startActivityForResult(Activity.java:3385)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.Activity.startActivity(Activity.java:3627)
03-28 13:24:29.900: E/AndroidRuntime(2947): at android.app.Activity.startActivity(Activity.java:3595)
03-28 13:24:29.900: E/AndroidRuntime(2947): at com.example.gmapsapp.homepage.onClick(homepage.java:15)
03-28 13:24:29.900: E/AndroidRuntime(2947): ... 14 more
主要节日
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gmapsapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".homepage"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAFjx4uMoTXzaYrSMyYeOnnE1pUeRVgxEA"/>
</application>
</manifest>
抱歉英语不好
答案 0 :(得分:0)
您还没有添加任何崩溃日志 但可能会出现错误:
public void onClick(View view) {
startActivity(new Intent("com.example.gmapsapp.MainActivity"));
}
我会改为:
public void onClick(View view)
{
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
或者您忘记在Manifest中使用Google地图声明活动