java.lang.RuntimeException - 显示fb登录后的Map活动

时间:2011-07-27 12:28:43

标签: android facebook runtimeexception

我有一个独立的应用程序,可以使用谷歌地图Api显示地图。我的想法是整合facebook登录,以便用户可以输入姓名并通过。我这样做但是现在我在尝试运行ShowTheMap活动时收到以下错误日志:

07-27 15:03:32.010: ERROR/AndroidRuntime(903): java.lang.RuntimeException: Unable to start activity ComponentInfo{mark.the.map/mark.the.map.ShowTheMap}: java.lang.NullPointerException
...
07-27 15:03:32.010: ERROR/AndroidRuntime(903):     at dalvik.system.NativeStart.main(Native Method)
07-27 15:03:32.010: ERROR/AndroidRuntime(903): Caused by: java.lang.NullPointerException
07-27 15:03:32.010: ERROR/AndroidRuntime(903):     at mark.the.map.ShowTheMap.onCreate(ShowTheMap.java:55)

这是我的ShowTheMap.java

...

public class ShowTheMap extends MapActivity 
{    
...
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mapView = (MapView) findViewById(R.id.mapView)
} 

}

它使用facebook connect和我的想法在成功连接后开始显示地图的新活动 - 应该怎么做?

当您将ShowTheMap作为独立项目运行时,它运行完美,没有任何错误。

1 个答案:

答案 0 :(得分:1)

你正在第50行传递null参数MarkTheMapActivity可能是你启动ShowTheMap.class的地方。通过你的说法你说ShowTheMap我单独独立应用程序。你不能像你一样运行单独的活动。您可以移动ShowTheMap.class并将其作为子活动启动。如果在当前项目中移动ShowTheMap类,一切都会正常。干杯

相关问题