解决方案 »

  1.   

    Activity最长执行时间是5秒,BroadcastReceiver最长执行时间则是10秒,超过了就会出现ANR你把初始化地图放在工作线程中,结束后通过handler发消息给主线程,来显示地图。
      

  2.   

    同楼上,主线程卡住5秒就会ANR的了.必须要新开线程,完成后通过handler通知主线程来更新界面. 百度地图自家的demo就有教怎么做的了,你可以去下一个,照着来修改.
      

  3.   

    BMapApiDemoApp app = (BMapApiDemoApp) this.getApplication();
    if (app.mBMapMan == null) {
    app.mBMapMan = new BMapManager(getApplication());
    app.mBMapMan.init(app.mStrKey,
    new BMapApiDemoApp.MyGeneralListener());
    }
    app.mBMapMan.start();
    // 如果使用地图SDK,请初始化地图Activity
    long iTime = System.nanoTime();
    super.initMapActivity(app.mBMapMan);
    iTime = System.nanoTime() - iTime;
    Log.d("MapViewDemo", "the init time is  " + iTime);
    mMapView = (MapView) findViewById(R.id.bmapView);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setDrawOverlayWhenZooming(true);
    GeoPoint point = new GeoPoint((int) (24.91536 * 1e6),
    (int) (118.6201 * 1e6));
    mMapView.getController().setCenter(point);
    mMapView.getController().setZoom(15); // 创建点击时的弹出泡泡
    mPopView = super.getLayoutInflater().inflate(R.layout.popview, null);
    mMapView.addView(mPopView, new MapView.LayoutParams(
    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, null,
    MapView.LayoutParams.TOP_LEFT));
    mPopView.setVisibility(View.GONE);
    iZoom = mMapView.getZoomLevel();
    我试了下还是会ANR  。  要把哪部分放在子线程呢?
      

  4.   

    为什么我放在子线程了还是一样会ANR
      

  5.   

    为什么我放在子线程了还是一样会ANR
    那你主线程在干什么呢?最好显示一个进度吧。
      

  6.   

    为什么我放在子线程了还是一样会ANR
    那你主线程在干什么呢?最好显示一个进度吧。
    主线程什么也没干了啊。