M
M
magical30002019-06-30 22:00:24
Android
magical3000, 2019-06-30 22:00:24

The application does not work on redmi 3s, what is the reason?

Good day. Recently, I ran into a problem. From one of the users who bought my application on google play, I received a message that the application does not work on redmi 3s.
The problem is that I have absolutely no idea what could be the reason. As the user reported, the error occurs when clicking on the button, which leads to the activity with the following code:

package com.magical3000.sweet_dreams;

import android.os.Bundle;
import android.content.Intent;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;

public class activity1 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_1);
        Dreaming();
    }

    MediaPlayer mPlayer;
    int i=0, limit=90, nowsound=R.raw.relax, check=0;

    public void onClicka1(View view) {
        mPlayer.stop();
        Intent intent = new Intent(activity1.this, ChooseActivity.class);
        startActivity(intent);
    }

    private void Dreaming() {
        mPlayer=MediaPlayer.create(this, nowsound);
        mPlayer.start();
        mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                Dreaming1();
            }
        });
    }

    private void Dreaming1() {
        if (i<limit)
        {
            i=i+1;
            mPlayer.start();
        }
        else
        {
            if (check==0 || check==2 || check==4)
            {
                Dreaming2();
            }
            else {
                if (check == 1 || check == 3) {
                    Dreaming3();
                }
                else {
                    if (check == 5) {
                        i = 0;
                        limit = 90;
                        nowsound = R.raw.relax;
                        mPlayer.start();
                    }
                }
            }
        }
    }

    private void Dreaming2() {
        check=check+1;
        nowsound=R.raw.sleep1;
        i=0;
        limit=270;
        mPlayer.start();
    }

    private void Dreaming3() {
        check=check+1;
        nowsound=R.raw.sleep2;
        i=0;
        limit=270;
        mPlayer.start();
    }

}

Please help me find the cause of the error and fix it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question