解决方案 »

  1.   

    这已经很清楚了啊,把goto到的代码段诺个位置,用{}括起来基本就差不多了
      

  2.   

    这是我整理后的,运行时报NULL指针,逻辑错误。
    public Engine onLoadEngine() {
           
            Resources resources = getResources();
            Constants.CAMERA_HEIGHT = resources.getDisplayMetrics().heightPixels;
            Constants.CAMERA_WIDTH = resources.getDisplayMetrics().widthPixels;
            Constants.defaultContext = this;
            Constants.defaultResources = resources;
            Saver.setSharedPreferences(getSharedPreferences(Saver.PREF_NAME, 0));
            Saver.loadLastLevel();
            Constants.STAGE_SCALE_Y = Constants.CAMERA_HEIGHT / Constants.STAGE_HEIGHT;
            Constants.STAGE_SCALE_X = Constants.CAMERA_WIDTH / Constants.STAGE_WIDTH;
            if(Constants.tasks.size() != 0)
            {
              Log.i(TAG, (new StringBuilder()).append("DATA: tasks len = ").append(Constants.tasks.size()).toString());
              mCamera = new Camera(0.0F, 0.0F, Constants.CAMERA_WIDTH, Constants.CAMERA_HEIGHT);
              RatioResolutionPolicy ratioresolutionpolicy = new RatioResolutionPolicy(Constants.CAMERA_WIDTH, Constants.CAMERA_HEIGHT);
              EngineOptions engineoptions = (new EngineOptions(true, org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation.PORTRAIT, ratioresolutionpolicy, mCamera)).setNeedsMusic(true).setNeedsSound(true);
              engineoptions.getTouchOptions().setRunOnUpdateThread(true);
              engineoptions.getRenderOptions().disableExtensionVertexBufferObjects();
              SceneManager.init(this);
              sceneManager = SceneManager.getManager();
              Constants.audioManager = (AudioManager)getSystemService("audio");
              Engine engine = new Engine(engineoptions);
              Constants.textureManager = engine.getTextureManager();
              Constants.defaultEngine = engine;
              return engine;
            }
            else
            {
             String as[];
             try
             {
              as = getImage();
              ShuffleArray.shuffleString(as);
              for(int i=0;i<as.length;i++)
              {
               String s = as[i].substring(0, as[i].indexOf(".jpg")).toLowerCase();
              if(Constants.completedTasks.contains(s))
                  Constants.tasks.add(0, s);
              else
               Constants.tasks.add(Constants.tasks.size(), s);
              }
            }
             catch(Exception exception)
             {}
            }
    return mEngine;
    }
    谢谢各位帮助