package com.example.admin.s20172296;

import android.content.Intent;
import android.graphics.Typeface;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    Button btnNewActivity;
    ImageButton song;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setTitle("메인");


        Typeface typeface = Typeface.createFromAsset(getAssets(), "SSAnt.ttf");
        TextView tv = (TextView) findViewById(R.id.tet01);
        tv.setTypeface(typeface);

        ImageButton song = findViewById(R.id.btn99);
        song.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                playAudio();
            }
        });


        btnNewActivity = (Button) findViewById(R.id.btn04);
        btnNewActivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,
                        SecondActivity.class);
                startActivity(intent);


            }
        });
    }

        private void playAudio(){
            MediaPlayer player;

            player=MediaPlayer.create(MainActivity.this, R.raw.sum);
            player.start();
        }

    }
