package com.example.kugoumusic;
import java.util.Timer;
import java.util.TimerTask;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.widget.ImageView;
public class Login_Activity extends Activity {
MediaPlayer media = new MediaPlayer();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_main);
Timer time = new Timer();
time.schedule(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
Intent it = new Intent();
it.setClass(Login_Activity.this, MainActivity.class);
startActivity(it);
media.release();
Login_Activity.this.finish();
}
}, 3000);
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
playLogin();
super.onStart();
}
public void playLogin(){
try {
media.reset();
media = MediaPlayer.create(this,R.raw.tell);
if(media != null)
media.stop();
media.prepare();
media.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
进入页面与音乐播放
最新推荐文章于 2022-04-28 16:20:16 发布