Android Open Source - Android_Pong Game Over Activity






From Project

Back to project page Android_Pong.

License

The source code is released under:

MIT License

If you think the Android project Android_Pong 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.pong.android;
//w w w.j  av a2  s.  c o  m
import com.pong.android.R;
import com.pong.android.R.id;
import com.pong.android.R.layout;
import com.pong.android.R.menu;
import com.pong.android.modell.breakout.BreakOutActivity;
import com.pong.android.modell.dodgeball.DodgeballActivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

public class GameOverActivity extends ActionBarActivity {
    
    public static String message = "";
    public static int retry = 0;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pong_game_over);
        updateText();
    }
 
    @Override 
    public void onStart(){
        super.onStart();
        updateText();
    }
    
    @Override
    public void onResume(){
        super.onResume();
        updateText();
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.pong_game_over, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
    
    public void btn1Clicked(View view) {
        if(retry == 1){
            startActivity(new Intent(this, PongActivity.class));
        } else if (retry == 2){
            startActivity(new Intent(this, DodgeballActivity.class));
        }
        else {
            startActivity(new Intent(this, BreakOutActivity.class));

        }
    }
    
    public void btn2Clicked(View view) {
        startActivity(new Intent(this, MenuActivity.class));
    }
    
    private void updateText(){
        TextView tv = (TextView) findViewById(R.id.textView1);
        tv.setText(message);
    }
    
}




Java Source Code List

com.pong.android.GameOverActivity.java
com.pong.android.IFGameEvents.java
com.pong.android.MenuActivity.java
com.pong.android.PongActivity.java
com.pong.android.modell.breakout.BreakOutActivity.java
com.pong.android.modell.breakout.BreakOutBall.java
com.pong.android.modell.breakout.BreakOutPlayer.java
com.pong.android.modell.breakout.BreakOutRenderer.java
com.pong.android.modell.breakout.Brick.java
com.pong.android.modell.breakout.Rectangle.java
com.pong.android.modell.dodgeball.Ball.java
com.pong.android.modell.dodgeball.DodgeballActivity.java
com.pong.android.modell.dodgeball.DodgeballPlayer.java
com.pong.android.modell.dodgeball.DodgeballRenderer.java
com.pong.android.modell.dodgeball.Rectangle.java
com.pong.android.modell.pong.Board.java
com.pong.android.modell.pong.PongBall.java
com.pong.android.modell.pong.PongOpponent.java
com.pong.android.modell.pong.PongPlayer.java
com.pong.android.modell.pong.PongRenderer.java
com.pong.android.modell.pong.Rectangle.java
com.pong.android.util.ShaderUtility.java