Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.phakeapps.mladmerindzhey.app;
- import android.app.Activity;
- import android.media.MediaPlayer;
- import android.os.Build;
- import android.os.Bundle;
- import android.support.v4.view.ViewPager;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.view.Window;
- import android.widget.Button;
- public class MainActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- this.requestWindowFeature(Window.FEATURE_NO_TITLE);
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- final Button button = (Button) findViewById(R.id.when_button);
- button.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- MediaPlayer mp = MediaPlayer.create(getBaseContext(),
- R.raw.when);
- mp.start();
- }
- });
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- MyPagerAdapter adapter = new MyPagerAdapter();
- ViewPager myPager = (ViewPager) findViewById(R.id.applicationSlide);
- myPager.setAdapter(adapter);
- myPager.setCurrentItem(0);
- }
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, 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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement