material-intro icon indicating copy to clipboard operation
material-intro copied to clipboard

Freeze when switching Activity

Open ahmadraza330 opened this issue 5 years ago • 8 comments

When I use the slider in my project and go from one activity to another Emulator freeze and I cannot see an error message in logact

ahmadraza330 avatar Dec 04 '20 08:12 ahmadraza330

If you cannot record a log, please record a screencast. And post the relevant code to help reproduce the issue. It would also help to know the specific versions of Android on the emulator and of material-intro.

janheinrichmerker avatar Dec 04 '20 08:12 janheinrichmerker

package com.example.organize.activity;
 
import androidx.appcompat.app.AppCompatActivity;
 
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
 
import com.example.organize.R;
import com.heinrichreimersoftware.materialintro.app.IntroActivity;
import com.heinrichreimersoftware.materialintro.slide.FragmentSlide;
 
public class MainActivity extends IntroActivity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_main);
        setButtonBackVisible(false);
        setButtonNextVisible(false);
 
        addSlide(new FragmentSlide.Builder()
                .background(android.R.color.white)
                .fragment(R.layout.intro_1)
        .build());
 
        addSlide(new FragmentSlide.Builder()
                .background(android.R.color.white)
                .fragment(R.layout.intro_2)
                .build());
 
        addSlide(new FragmentSlide.Builder()
                .background(android.R.color.white)
                .fragment(R.layout.intro_3)
                .build());
 
        addSlide(new FragmentSlide.Builder()
                .background(android.R.color.white)
                .fragment(R.layout.intro_4)
                .build());
 
        addSlide(new FragmentSlide.Builder()
                .background(android.R.color.white)
                .fragment(R.layout.register_intro)
                .build());
    }
 
    public void btnLogin(View view) {
        Intent i = new Intent(MainActivity.this, LoginActivity.class);
        startActivity(i);
    }
 
    public void btnRegister(View view) {
        Intent i = new Intent(MainActivity.this, RegisterActivity.class);
        startActivity(i);
    }
}

As you see in my code when I press the button for another activity my emulator is freeze and I didn't see any error message

ahmadraza330 avatar Dec 04 '20 10:12 ahmadraza330

I use material intro version 2.0.0 and API level 30

ahmadraza330 avatar Dec 04 '20 12:12 ahmadraza330

Sorry, I still can't reproduce your issue. What code is calling btnLogin then? Please record a screencast.

janheinrichmerker avatar Dec 04 '20 21:12 janheinrichmerker

Another relevant detail would be the startup code of both LoginActivity and RegisterActivity. Because on Android the screen only changes visibly after the new activity has started.

janheinrichmerker avatar Dec 04 '20 21:12 janheinrichmerker

Screenshot_1607141633 When I press the button the login screen cannot open and the emulator stuck.

ahmadraza330 avatar Dec 05 '20 04:12 ahmadraza330

Sorry for the confusion: I meant a video recording of the emulator screen, so that I can see when exactly the freeze occurs. I still can't reproduce the issue. Did you test this with different emulators/devices? And could you please test, if the activity switches correctly when you start the same Intent from a standard Activity? It seems to me at the moment that this is not caused by material-intro but rather by the emulator or the LoginActivity/RegisterActivity startup code. Because I am not able to reproduce the issue with the code you sent.

janheinrichmerker avatar Dec 05 '20 16:12 janheinrichmerker

By the way, I reformatted the code snippet in your previous comment. You can do that yourself. Just refer to the GitHub Markdown guide.

janheinrichmerker avatar Dec 05 '20 16:12 janheinrichmerker