Android Open Source - Tetris_android Menu Activity






From Project

Back to project page Tetris_android.

License

The source code is released under:

GNU General Public License

If you think the Android project Tetris_android 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 fr.tiphedor.tetris;
/*  ww  w. ja va 2 s  .  c  o  m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;


public class MenuActivity extends Activity {

    private AdView adView;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);

        final String AD_UNIT_ID = new adStrategy().getAD_UP_PUB();

        adView = new AdView(this);
        adView.setAdSize(AdSize.BANNER);
        adView.setAdUnitId(AD_UNIT_ID);



        LinearLayout layout = (LinearLayout) findViewById(R.id.adLayout);
        layout.addView(adView);

        AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice("792CFECEEDC59EC321E0804EF429D66B")
                .build();

        // Start loading the ad in the background.
        adView.loadAd(adRequest);



        Button btnPlay = (Button) findViewById(R.id.btnPlay);
        btnPlay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intGoPlay = new Intent(MenuActivity.this, GameActivity.class);
                startActivity(intGoPlay);
                finish();
            }
        });

    }

    @Override
    public void onResume() {
        super.onResume();
        if (adView != null) {
            adView.resume();
        }
    }

    @Override
    public void onPause() {
        if (adView != null) {
            adView.pause();
        }
        super.onPause();
    }

    @Override
    public void onDestroy() {
        // Destroy the AdView.
        if (adView != null) {
            adView.destroy();
        }
        super.onDestroy();
    }

}




Java Source Code List

fr.tiphedor.tetris.CollisionManager.java
fr.tiphedor.tetris.Coordinate.java
fr.tiphedor.tetris.GameActivity.java
fr.tiphedor.tetris.MenuActivity.java
fr.tiphedor.tetris.Piece.java
fr.tiphedor.tetris.RotationManager.java
fr.tiphedor.tetris.TetrisView.java