janheinrichmerker/material-intro

Freeze when switching Activity

ahmadraza330 opened this issue · 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

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.

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

I use material intro version 2.0.0 and API level 30

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

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.

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

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.

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