Ole*_*ena 7 android back xamarin
我有:
public override void OnBackPressed ()
{
base.OnBackPressed ();
}
Run Code Online (Sandbox Code Playgroud)
Xamarin是否具有BackStackEntryCount,我该如何使用它?
例如,我单击MainMenu-> Study-> Categories-> FirstCategory,如果单击Back,我想要分类.
If the Categories activity precedes the Selected category in the activity stack and is not flagged for no history OnbackPressed without override of the base/super class will take you back to the categories class and hit the OnResume method.
If you loaded your Categories activity in OnCreate and dont do anything in OnResume then OnBackPressed should show the previous activity in the state you left it.
If you want it to do something else then override on OnBackPressed and flag Categories as no history.
Override OnBackPressed
public override void OnBackPressed()
{
//Do not call the base method
//base.Onbackpressed
//Do something else
*something else code*
//finish this activity unless you want to keep it for some reason
finish();
}
Run Code Online (Sandbox Code Playgroud)
NoHistory
[Activity
(
NoHistory = true
)
]
Public Class Categories : Activity
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21582 次 |
| 最近记录: |