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));
}