难以将单独的项目集成到其他项目中

时间:2011-10-26 20:45:30

标签: android android-layout android-emulator android-widget android-manifest

我有一个gui由三个按钮组成的项目。现在这些按钮中的一个与其他活动相关联。我已经分别开发了这个活动的代码并进行了测试但是现在当我将它集成到我的主gui项目它显示错误。(点击按钮将获得谷歌地图上的当前位置。)

这是我的日志猫:

10-27 01:45:44.533: E/ActivityThread(357): Failed to find provider info for com.google.settings
10-27 01:45:44.563: E/ActivityThread(357): Failed to find provider info for com.google.settings
10-27 01:45:44.633: D/AndroidRuntime(357): Shutting down VM
10-27 01:45:44.633: W/dalvikvm(357): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
10-27 01:45:44.643: E/AndroidRuntime(357): Uncaught handler: thread main exiting due to uncaught exception
10-27 01:45:44.653: E/AndroidRuntime(357): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gui/com.example.gui.LocationActivity}: java.lang.NullPointerException
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.os.Looper.loop(Looper.java:123)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.ActivityThread.main(ActivityThread.java:4363)
10-27 01:45:44.653: E/AndroidRuntime(357):  at java.lang.reflect.Method.invokeNative(Native Method)
10-27 01:45:44.653: E/AndroidRuntime(357):  at java.lang.reflect.Method.invoke(Method.java:521)
10-27 01:45:44.653: E/AndroidRuntime(357):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-27 01:45:44.653: E/AndroidRuntime(357):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-27 01:45:44.653: E/AndroidRuntime(357):  at dalvik.system.NativeStart.main(Native Method)
10-27 01:45:44.653: E/AndroidRuntime(357): Caused by: java.lang.NullPointerException
10-27 01:45:44.653: E/AndroidRuntime(357):  at com.example.gui.LocationActivity.onCreate(LocationActivity.java:50)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-27 01:45:44.653: E/AndroidRuntime(357):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
10-27 01:45:44.653: E/AndroidRuntime(357):  ... 11 more
10-27 01:45:44.693: I/dalvikvm(357): threadid=7: reacting to signal 3
10-27 01:45:44.693: E/dalvikvm(357): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

您收到错误消息,因为在致电

时第50行
map.setBuiltInZoomControls(true);

您的map变量为空。请发布您的main.xml文件,因为当您致电onCreate时,findViewById方法正在查找视图。

setContentView(R.layout.main);