White screen in transition between activities

2

I have a project in which I developed a method to save a reference of the current activity and when I used the HOME of the next screen, it returned to activity using that saved reference.

But when I press it back, the screen goes completely white and immediately follows the desired flow. This problem only occurs in 8.0+ android versions.

Here is the OnOptionsItemsSelected created:

case Android.Resource.Id.Home:
                DroidApplication.current.navigation.StartActivity(ownerActivity, DroidApplication.current.CurrentTypeActivity);
                return true;

                default:
                return base.OnOptionsItemSelected(item);

Follow StartActivity :

 public void StartActivity(Activity activity, Type activityDestino, Dictionary<string, object> prefs)
    {
        StartActivity(activity, new Intent(activity, activityDestino), prefs);
    }

    public void StartActivity(Activity activity, Type activityDestino)
    {
        StartActivity(activity, new Intent(activity, activityDestino), null);
    }

    public void StartActivity(Activity activity, Intent intent, Dictionary<string, object> prefs)
    {
        int animationIn = Resource.Animation.fade_in;
        int animationOut = Resource.Animation.fade_out;

        StartActivity( activity, intent, animationIn, animationOut, prefs);
    }

    public void StartActivity(Activity activity, Intent intent, int animationIn, int animationOut, Dictionary<string, object> prefs)
    {
        SavePreferences(activity, prefs);
        intent.AddFlags(ActivityFlags.NoAnimation);
        intent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
        activity.StartActivity(intent);
        //activity.OverridePendingTransition(animationIn, animationOut);
    }

When I starto a activity , no problem occurs and I use the same method:

Example:

else if (codigoAcao == CODIGO_ACAO_ACTIVITY_MAIN)
        {
            DroidApplication.retornarInicial = false;
            StartActivity(activity, typeof(MainActivity));
        }
    
asked by anonymous 02.05.2018 / 19:42

1 answer

1

I was able to solve my problem ...

When I used this:

 intent.AddFlags(ActivityFlags.NoAnimation);
 intent.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);

All the pile of activities were cleaned. This caused my references to be lost and when I returned to the activity, I would have to reload it ... This creation time of the screen was white and only after the layout appeared ... So the solution was to pull out those lines of code that have been resolved.

    
04.05.2018 / 18:59