MainActivity.java
package com.example.myapplication;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
RadioButton ch1,ch2;
TextView txt;
ImageButton mStopButton,mStarButton,mPauseButton;
MediaPlayer mMediaPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMediaPlayer=new MediaPlayer();
ch1=(RadioButton) findViewById(R.id.check1);
ch2=(RadioButton) findViewById(R.id.check2);
txt=(TextView)findViewById(R.id.text1);
mStarButton=(ImageButton)findViewById(R.id.Start);
mStopButton=(ImageButton)findViewById(R.id.Sto

本文介绍了如何使用Android技术创建一个简单的音乐播放器。主要涉及MainActivity.java的代码逻辑,activity_main.xml的布局设计,以及strings.xml中相关字符串资源的定义。
最低0.47元/天 解锁文章
766

被折叠的 条评论
为什么被折叠?



