I have a problem in my app is that when the user hit back button multiple times the app become crashed.Is there any way to handle this problem ?Is any way to disable back button after the first click from a page.so further click can be avoided.The exception i am getting while hitting back button multiple time is 0x8000ffff.Is there any solution for this in windows phone 7.1?
You should fix the issue which is causing your app to crash. If you disable the back button behaviour you risk failing marketplace certification due to requirement 5.2.4[.1] http://msdn.microsoft.com/en-us/library/hh184840(v=VS.92).aspx
You can control that, here is a sample code:
private void YourPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
{
//App.NaviService.BackKeyPress(sender, e);
if (NavigationService.CanGoBack)
{
NavigationService.GoBack();
}
}
Related
I am developing a Windows 10 UWP app with Visual Studio 2015. I am working on the back button functionality right now. Unfortunately there is a problem. When I press the back button (either on a Phone or on the PC) it doesn't go back to the previous page. When I press it again it works.
It is like this example:
Start App (page 1)
Go to page 2
Go to page 3
Click back button (nothing happens)
Click back button (it goes to page 2)
Click back button (it goes to page 1)
So the first time when you want to go back it needs two presses... why? Additionally I've found out that the first press doesn't trigger the back button event. But why?
I am using the implementation as described in this article:
http://www.wintellect.com/devcenter/jprosise/handling-the-back-button-in-windows-10-uwp-apps
It has to do with SplitView staying open and holding the back event. You should close it if you are using it as overlay.
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
this.SplitView.IsPaneOpen = false;
Frame.Navigate(typeof(SettingsPage));
}
We are developing an hybrid mobile application using Sencha touch 2 for Windows Phone 8.
While developing we noticed that for a number field in windows phone 8 there is no keyboard done button available.Please refer to the below screenshot.
We then decided to write a custom application bar in Windows Phone 8 - Phonegap application inside the MainPage.cs with an Done button inside that application bar.Please refer to the below screenshot.
Now the done functionality works fine but when we click on the back button of the device the keyboard hides but the application bar remains in the view as in the below screenshot
We tried overriding the back button functionality in phonegap, but when the keyboard is shown the back button click is fired only the second click ,the first click hides the keyboard and the second click fires the overridden function.
Can someone provide some alternatives or a solution on how to hide the custom application bar along with the keyboard when the back button is clicked the first time ?
In MainPage.xaml.cs add listener mentioned below which listens the event when back button is pressed in device when keypad is opened.
And pass a string from java script when ur calling particular plugin to show the application bar contains done button, by using that you can identify in which case you have to show and other case you can hide the bar.
cordova.exec(null, null, "Cordova.Extension.Commands.DoneButtonPlugin", "keyboardDoneShow", "Num");
cordova.exec(null, null, "Cordova.Extension.Commands.DoneButtonPlugin", "keyboardDoneHide", "input string");
private void CordovaView_LayoutUpdated(object sender, EventArgs e)
{
if (CordovaView.Content.DesiredSize.Height == 0)
{
if(App.appBar.IsVisible)
App.HideShell();
}
else
{
if (App.NumKey == "\"Num\"") {
if(!App.appBar.IsVisible)
App.ShowShell();
}
}
}
I noticed an issue where calling DeviceNetworkInformation.ResolveHostNameAsync prevents the app from resuming from a tombstoned state. If you force tombstoning upon deactivation when debugging (via the project settings, debug tab), pressing the Windows button and then the Back button to return to the app causes the phone/emulator to display "Resuming..." and never actually return from the tombstoned state.
To test this, I created a new WP7.1 app and added a button with the following action:
private void Button_Click(object sender, RoutedEventArgs e)
{
DeviceNetworkInformation.ResolveHostNameAsync(new DnsEndPoint("google.com", 0), HostNameResolutionCallback, null);
}
For testing, my callback method doesn't actually do anything:
private static void HostNameResolutionCallback(NameResolutionResult result)
{
}
If you tap the button, exit, and then return to the app, it will display "Resuming..." until you press the Windows button again.
I am using the WP7.1 Beta 2 Refresh SDK.
Any ideas?
I suspect that you're starting the app with the debugger attached.
When you force tombstoning the process is being ended and so when you resume the emulator is waiting for you to restart the debugger so you can continue debugging the app.
This behaviour is by design. It is to allow you to continue debugging after tombstoning.
If you force tombstoning while debugging and the app appears to be stuck in the resuming state just hit F5 (Debug > Start Debugging) in Visual Studio to resume the app and the debug session.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Windows Phone 7 close application
How to Exit from the app when user presses Back Key Button from Device??
Thanks,
Balaram.
This is handled automatically for you.
<slightly simplfied answer>
The back button gives access to the navigation system within the application. If there are previous pages to return to, the back button will take you back to the most recent previous page. If there are no previous pages, the application will exit. You don't need to do anything to make it exit.
</slightly simplfied answer>
Here's how I do it:
void Exit()
{
while (NavigationService.BackStack.Any())
NavigationService.RemoveBackEntry();
base.OnBackKeyPress(new CancelEventArgs());
}
Best of luck to you.
This is handled automatically for you if you are on the first page the app began with.
Now you can override the backkey press event but you run the risk of not passing certification when you submit the app. The backkey is meant to go to the previous page of the application, and exit if its the first page. Microsoft does have exceptions to this, such as pausing a game, but other than that it has to stick to its intended purpose.
You can always call an exit by doing this at your landing page use this code on click of your application back button:
if (NavigationService.CanGoBack)
{
while (NavigationService.RemoveBackEntry() != null)
{
NavigationService.RemoveBackEntry();
}
}
This will remove back entries from the stack, and you will press a back button it will close the application without any exception.
If you really want to do Exit, you can throw an unhandled exception and your app will close. But it is a very bad thing to do!
In the Certification guidelines 5.2.4 C they mentioned that if the current page displays a context menu or a dialog, the pressing of the Back button must close the menu or dialog and cancel the backward navigation to the previous page.
Is this applicable for MessageBox also?
I am using MessageBox to prompt the user to allow the location service api to use location i.e. lat and long which is in application launching.
Do I have to follow the 5.2.4 C for the MessageBox too be closed and stop back navigation.
Please guide me for standard way to implement so not to fail in Windows phone 7 Certification process.
4.Check the Back button Twice:
protected override void OnBackKeyPress( System.ComponentModel.CancelEventArgs e )
{
if (DemoPopup.isOpen)
{
e.Cancel = true;
//hide the popup
DemoPopup.IsOpen = false;
}
else
{
base.OnBackKeyPress(e);
}
}
Yes, if you have a Message Box displayed (or a Context Menu) then pressing the back button should dismiss the Message Box instead of navigating backwards, i.e. backwards navigation should not occur.
However, in the case of MessageBox.Show and ContextMenu (from the Silverlight Toolkit), I think this happens for you automatically.