Play sound continuously onTouch()

前端 未结 4 1567
傲寒
傲寒 2021-01-20 02:48

I want to play a gun shot sound continuously by onTouch. I am doing this for automatic gun sounds. So i have problem with there is delay in sound looping. which does not giv

4条回答
  •  花落未央
    2021-01-20 03:03

    agree with @haresh : try this one ..

    runOnUiThread(new Runnable() {
                        public void run() {
    
                            if (pd.isShowing()) {
    
                                pd.dismiss();
                            }
                            Toast.makeText(getApplicationContext(), "" + msg,
                                    Toast.LENGTH_LONG).show();
    
                        }
                    });
    

    here I m closing progress dialog and display some msg on screen .you can start or stop your media player like this way .

提交回复
热议问题