Advertisement
Guest User

Untitled

a guest
Jul 10th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.95 KB | None | 0 0
  1. package com.phakeapps.mladmerindzhey.app;
  2.  
  3. import android.app.Activity;
  4. import android.media.MediaPlayer;
  5. import android.os.Build;
  6. import android.os.Bundle;
  7. import android.support.v4.view.ViewPager;
  8. import android.view.Menu;
  9. import android.view.MenuItem;
  10. import android.view.View;
  11. import android.view.Window;
  12. import android.widget.Button;
  13.  
  14.  
  15. public class MainActivity extends Activity {
  16.  
  17.     @Override
  18.     protected void onCreate(Bundle savedInstanceState) {
  19.         this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  20.         super.onCreate(savedInstanceState);
  21.         setContentView(R.layout.main);
  22.  
  23.         final Button button = (Button) findViewById(R.id.when_button);
  24.         button.setOnClickListener(new View.OnClickListener() {
  25.             public void onClick(View v) {
  26.                 MediaPlayer mp = MediaPlayer.create(getBaseContext(),
  27.                         R.raw.when);
  28.                 mp.start();
  29.             }
  30.         });
  31.  
  32.         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
  33.             MyPagerAdapter adapter = new MyPagerAdapter();
  34.             ViewPager myPager = (ViewPager) findViewById(R.id.applicationSlide);
  35.             myPager.setAdapter(adapter);
  36.             myPager.setCurrentItem(0);
  37.         }
  38.     }
  39.  
  40.  
  41.     @Override
  42.     public boolean onCreateOptionsMenu(Menu menu) {
  43.         // Inflate the menu; this adds items to the action bar if it is present.
  44.         getMenuInflater().inflate(R.menu.main, menu);
  45.         return true;
  46.     }
  47.  
  48.     @Override
  49.     public boolean onOptionsItemSelected(MenuItem item) {
  50.         // Handle action bar item clicks here. The action bar will
  51.         // automatically handle clicks on the Home/Up button, so long
  52.         // as you specify a parent activity in AndroidManifest.xml.
  53.         int id = item.getItemId();
  54.         if (id == R.id.action_settings) {
  55.             return true;
  56.         }
  57.         return super.onOptionsItemSelected(item);
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement