专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

activity 跳转到mapactivity 报空指针错误 急

发布时间:2010-05-30 10:33:21 文章来源:www.iduyao.cn 采编人员:星星草
activity 跳转到mapactivity 报空指针异常 急~~~~~
从一个普通activity跳转到mapactivity时报错,以下是代码:

跳转代码:
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//showCityDialog();
Intent intent=new Intent();
intent.setClassName("com.kd", "com.kd.activitys.ShowMapActivity");
startActivity(intent);
}

 
mapactivity代码:
@Override
protected void onCreate(Bundle arg0) {
// TODO Auto-generated method stub
super.onCreate(arg0); 这里报错
mapView=new MapView(this, Utitls.getMapKey());
mapView.setSatellite(false);
  mapView.setStreetView(false);
  mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
mapCtrl=mapView.getController();
mapCtrl.setZoom(25);
lon=33.0000;
lat=33.0000;
GeoPoint centerP=new GeoPoint((int)(lat*1E6), (int)(lon*1E6));
mapCtrl.setCenter(centerP);


setContentView(mapView);

}

xml 文件:
 </application>
  <uses-library android:name="com.google.android.maps" />
  </application>
这个也加上了 

错误内容:
E/AndroidRuntime( 1753): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ufida.kdlife/com.kd.activitys.ShowMapActivity}: java.lang.NullPointerException
E/AndroidRuntime( 1753): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1752)
E/AndroidRuntime( 1753): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1768)
E/AndroidRuntime( 1753): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
E/AndroidRuntime( 1753): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:936)
E/AndroidRuntime( 1753): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1753): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1753): at android.app.ActivityThread.main(ActivityThread.java:3812)
E/AndroidRuntime( 1753): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1753): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1753): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
E/AndroidRuntime( 1753): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/AndroidRuntime( 1753): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1753): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 1753): at android.app.ContextImpl.openFileOutput(ContextImpl.java:436)
E/AndroidRuntime( 1753): at android.content.ContextWrapper.openFileOutput(ContextWrapper.java:158)
E/AndroidRuntime( 1753): at com.google.common.io.android.AndroidPersistentStore.writeBlockX(Unknown Source)
E/AndroidRuntime( 1753): at com.google.common.io.android.AndroidPersistentStore.writeBlock(Unknown Source)
E/AndroidRuntime( 1753): at com.google.common.io.PreferenceStore.ensurePreferencesLoaded(Unknown Source)
E/AndroidRuntime( 1753): at com.google.common.io.PreferenceStore.readPreference(Unknown Source)
E/AndroidRuntime( 1753): at com.google.common.io.BasePersistentStore.readPreference(Unknown Source)
E/AndroidRuntime( 1753): at com.google.common.StaticUtil.readPreferenceAsDataInput(Unknown Source)
E/AndroidRuntime( 1753): at com.google.googlenav.datarequest.DataRequestDispatcher.loadOrRequestCookie(Unknown Source)
E/AndroidRuntime( 1753): at com.google.googlenav.datarequest.DataRequestDispatcher.<init>(Unknown Source)
E/AndroidRuntime( 1753): at com.google.googlenav.datarequest.DataRequestDispatcher.createInstance(Unknown Source)
E/AndroidRuntime( 1753): at com.google.android.maps.MapActivity.createMap(MapActivity.java:509)
E/AndroidRuntime( 1753): at com.google.android.maps.MapActivity.onCreate(MapActivity.java:409)
E/AndroidRuntime( 1753): at com.kd.activitys.ShowMapActivity.onCreate(ShowMapActivity.java:23)
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: