小编use*_*154的帖子

如何在android中循环声音

按下按钮时首先声音有效.然后再次按下该按钮它将停止并且第二个声音激活我的代码是否正常?

package com.Randomsentence;
    import java.util.Random;
    import android.app.Activity;
    import android.content.res.Resources;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;

    public class Randomsentence extends Activity {
      boolean showRandom = false;
      TextView txt;
      int time = 30;
      int random;
      public String[] myString;
      Button bt1;
      boolean check = false;

      @Override
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        txt=(TextView)findViewById(R.id.txt);
        bt1 = (Button)findViewById(R.id.bt1);
        Medaiplayer mp = new Medaiplayer();
        Mediaplayer mp2 = new Mediaplayer();
        bt1.setOnClickListener(new View.OnClickListener() {

          @Override
      public void onClick(View v) …
Run Code Online (Sandbox Code Playgroud)

java audio android

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

audio ×1

java ×1