Created
April 28, 2012 07:42
-
-
Save chrishuan9/2516930 to your computer and use it in GitHub Desktop.
GameView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LudoActivity extends Activity implements OnClickListener { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
requestWindowFeature(Window.FEATURE_NO_TITLE); | |
FrameLayout Game = new FrameLayout(this); | |
GameView Gameview = new GameView (this); | |
LinearLayout GameWidgets = new LinearLayout (this); | |
Button EndGameButton = new Button(this); | |
TextView MyText = new TextView(this); | |
EndGameButton.setWidth(300); | |
EndGameButton.setText("Start Game"); | |
MyText.setText("rIZ..i"); | |
GameWidgets.addView(MyText); | |
GameWidgets.addView(EndGameButton); | |
Game.addView(Gameview); | |
Game.addView(GameWidgets); | |
setContentView(Game); | |
EndGameButton.setOnClickListener(this); | |
} | |
public void onClick(View v) { | |
Intent intent = new Intent(this, LudoActivity.class); | |
startActivity(intent); | |
// re-starts this activity from game-view. add this.finish(); to remove from stack | |
} | |
} | |
//GameView: | |
public class GameView extends SurfaceView { | |
public GameView(Context context) { | |
super(context); | |
/* | |
* your code | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment