Advertisement
brandonlnelson15

PokeMyGummyActivity.java

Aug 18th, 2012
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.37 KB | None | 0 0
  1. public class PokeMyGummyActivity extends Activity {
  2.    
  3.     int count = 0;
  4.     MediaPlayer mediaPlayer;
  5.     private int hits = 0;
  6.     private WebView mWebView;
  7.  
  8.  
  9.    
  10.     /** Called when the activity is first created. */
  11.     @Override
  12.     public void onCreate(Bundle icicle) {
  13.         super.onCreate(icicle);
  14.        
  15.        
  16.        
  17.        
  18.         TapForTap.setDefaultAppId("f1fc6a00-c2f3-012f-fa76-4040d804a637");
  19.        TapForTap.checkIn(this);
  20.        
  21.         setContentView(R.layout.main);
  22.  
  23.        
  24.        
  25.        
  26.         final Button button02 = (Button) findViewById(R.id.button02);      
  27.         final Button button01 = (Button) findViewById(R.id.button01);
  28.        
  29.         final AdView adView = (AdView) findViewById(R.id.ad_view);
  30.  
  31.         final int[] array01;
  32.         array01 = new int[10];
  33.         array01[0]=R.drawable.button_bluegummy;
  34.         array01[1]=R.drawable.button_pinkgummy;
  35.         array01[2]=R.drawable.button_greengummy;
  36.         array01[3]=R.drawable.button_magentagummy;
  37.         array01[4]=R.drawable.button_orangegummy;
  38.         array01[5]=R.drawable.button_tealgummy;
  39.         array01[6]=R.drawable.button_purplegummy;
  40.         array01[7]=R.drawable.button_darkbluegummy;
  41.         array01[8]=R.drawable.button_yellowgummy;
  42.         array01[9]=R.drawable.button_redgummy;
  43.        
  44.         mediaPlayer = MediaPlayer.create(this, R.raw.lucigiggle);
  45.  
  46.        
  47.         button02.setOnClickListener(new View.OnClickListener() {
  48.    
  49.            
  50.             @Override
  51.             public void onClick(View v) {
  52.                
  53.                 mWebView = (WebView) findViewById(R.id.webview);
  54.                 mWebView.getSettings().setJavaScriptEnabled(true);
  55.  
  56.                 //for play
  57.                 mWebView.loadUrl("market://details?id=com.brndev.gummypoprun");
  58.                
  59.                
  60.                
  61.             }
  62.                
  63.         });
  64.        
  65.        
  66.  
  67.        
  68.        
  69.         button01.setOnClickListener(new View.OnClickListener() {
  70.    
  71.            
  72.             @Override
  73.             public void onClick(View v) {
  74.                
  75.                     button01.setBackgroundResource(array01[count]);
  76.                     count+=1;
  77.                     hits+=1;
  78.                    
  79.                     if(count>=10)
  80.                     {
  81.                         count=0;
  82.                     }
  83.                    
  84.                     if(hits>=20)
  85.                     {
  86.                         hits=0;
  87.                     }
  88.                    
  89.                     mediaPlayer.start();
  90.    
  91.                 }
  92.                
  93.         });
  94.        
  95.         adView.loadAds();
  96.  
  97.        
  98.     }
  99.    
  100.    
  101.     public void onResume() {
  102.         super.onResume();
  103.  
  104.     adView.loadAds();
  105.  
  106.     }
  107.  
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement