Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeze when switching Activity #304

Open
ahmadraza330 opened this issue Dec 4, 2020 · 8 comments
Open

Freeze when switching Activity #304

ahmadraza330 opened this issue Dec 4, 2020 · 8 comments

Comments

@ahmadraza330
Copy link

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

@heinrichreimer
Copy link
Owner

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.

@heinrichreimer heinrichreimer changed the title Activity Freeze when switching Activity Dec 4, 2020
@ahmadraza330
Copy link
Author

ahmadraza330 commented Dec 4, 2020

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
Copy link
Author

I use material intro version 2.0.0 and API level 30

@heinrichreimer
Copy link
Owner

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

@heinrichreimer
Copy link
Owner

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.

@ahmadraza330
Copy link
Author

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

@heinrichreimer
Copy link
Owner

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.

@heinrichreimer
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants