Android Open Source - DroidRunJump Droid Run Jump Activity






From Project

Back to project page DroidRunJump.

License

The source code is released under:

"Droid-Run-Jump" Copyright (c) 2011 Donald E. Llopis <machinezilla@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentati...

If you think the Android project DroidRunJump listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.android.sofla.drj;
//ww w  .  ja  va2  s.co  m
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;

import com.android.sofla.drj.DroidRunJumpView.DroidRunJumpThread;


public class DroidRunJumpActivity extends Activity {
  
  public static final String PREFS_NAME = "DRJPrefsFile";
  
  DroidRunJumpView drjView;
  DroidRunJumpThread drjThread;
  
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        
        setContentView(R.layout.main);        
        drjView = (DroidRunJumpView) findViewById(R.id.droidrunjump);                       
    }
    
    @Override
    protected void onPause() {
      super.onPause();

      SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
         SharedPreferences.Editor editor = settings.edit();
         
         drjThread = drjView.getThread();
                        
         // if player wants to quit then reset the game
      if (isFinishing()) {
        drjThread.resetGame();
      }
      else {        
        drjThread.pause();
      }
      
         drjThread.saveGame(editor);
    }
    
    @Override
    protected void onResume() {
      super.onResume();    
      // restore game
      drjThread = drjView.getThread();    
      SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
       drjThread.restoreGame(settings);  
    }   
}




Java Source Code List

com.android.sofla.drj.DroidRunJumpActivity.java
com.android.sofla.drj.DroidRunJumpView.java
com.android.sofla.drj.Droid.java
com.android.sofla.drj.Game.java
com.android.sofla.drj.Pastry.java
com.android.sofla.drj.Pothole.java
com.android.sofla.drj.Road.java