I want to enable default android back button, I use
getActionbar().setDisplayHomeAsUpEnabled(true);
in my application but the back function not working, I use fragment transaction to replace fragment in my activity, I used addtoBackStack() also, my device back button is working, but the android default back button is not working in my application.
How to do it?
Don't finish your activity on click of the help menu. Once you call finish, the activity will be destroyed and removed from the activity stack (so when you press back, it's no longer the previous activity).
You should only finish the activity when it is truly done (i.e. the user has completed whatever it is that the activity was supposed to let them do). You need to think of the set of activities in your application as a stack. Each time you start an activity, it is placed at the top of the stack. If you want the back button to take you back to the previous activity, don't finish it (since each time you call finish it removes it from the stack). Every time the user presses back, the current activity is "popped" from the stack and the system resumes the activity below it. If there are no more activities from your app on the stack when the user presses back, your app is finished and the user goes back to the home screen.
Related
I want to show my Chrome extension popup in a window through the click of a keyboard command and hide it once the respective modifier keys are released. It works, but it's not fast enough taking 150ms from triggering to adding the event listeners that detects the modifier-key release.
Problem: the release won't be detected if the user releases the keys too fast.
I suppose there are many ways to improve loading time; or at least I hope.
Therefore I am more interested in key state detection.
Is it possible to detect the state of a modifier-key without an event? I already tried dispatching a keyboard event myself in order to read the modifier key state, but that was a stupid idea...
How to listen to key events during the transition phase when a window is created? Using a content script could work, but since I use global commands, Chrome may not even be focused.
Basically that's how I do it:
using
chrome.windows.create({'url': chrome.extension.getURL("popup.html"),'type': 'popup', ... to show and
window.addEventListener('keyup', function (event) {}); to listen.
I want to know how to make a floating button or anything extra. In android studio that remains on the screen even after closing activity.
Whenever the activity is closed (I assume you mean the moment when onDestroy() method is called) every thread used by your app is closed until onCreate() method is called again.
i think you want to make a floating widget like messenger. please follow the bellow link.
https://www.androidhive.info/2016/11/android-floating-widget-like-facebook-chat-head/
In Visual Studi you can do recording in IE as an example. You enter an url, insert some data and finish your recording. After that some code are generated. What if you want to change the recording? How do you resume a recording if something in the user interface changes? Do you have to sart all over start a recording based on the generated code?
You can add new recordings without losing the old. The normal recorder is used. When you save a part of the recording you name the action or assertion method. If the same name as an existing method is used than that method is replaced. However a completely new method can be created.
Assuming that you are using the default UT Map then position the cursor in the c where the new method should be called. Use the context (right-click) menu at that cursor position (I find adding a empty line makes it obvious where the new call will be inserted) and select the command Generate code for Coded UI test => Use Coded UI test builder. The normal Coded UI recorder will start.
If you are using multiple UI Maps then select the UI Map to have the new code and from its context menu select the ""Edit with Coded UI test builder" command. After recording a new method, add a call of it in the required test method.
If the new recording is wanted to replace a small part of an existing method, or to go in the middle, then I recommend using the UI Map editor to split the existing method into two or more pieces and then use the recorder to replace the unwanted part leaving the wanted parts as originally recorded.
A breakpoint can be set within a Coded UI test then, when the test is run in debug mode, execution will stop at the breakpoint. This lets the test be executed as so as to move the application being tested to a specific place within the test. Having reached the desired breakpoint, the test execution (ie the debug session) should be stopped. At this time the application is waiting for further input and the recording actions described above can be used. There are several ways of startng the test in debug mode, including the options on the "Run test" icon and the context menu of the [TestMethod].
I have been building an IT Ticketing / inventory system, and the program is done, now I'm adding instructions for the end users and the other techs in our school. Since I know nobody will read an instruction manual, I opted to make instructions for each screen, and put them in Modal Windows, activated by pushing a Help button I added to the Screen Commands section.
That works wonderfully, so I decided to capture the KeyDown event, and launch the window if they press F1. This is where things get a little weird.
If the HelpWindow for this particular screen has been opened at least once, pressing F1 opens it again with no trouble. If it has never been opened, pressing F1 results in an Error 'Control 'HelpWindow' doesn't contain a modal window. OpenModalWindow/CloseModalWindow cannot be used.'
After closing this error message, F1 will launch the HelpWindow exactly as expected. Very bizarre...
Background information:
Visual Studio 2012
Lightswitch project in VB (I work in both VB and C#, flipped a coin for this project)
The Modal Window is a group on the screen that is not visible, named "HelpWindow"; I use OpenModalWindow("HelpWindow") to open it. The exact same line of code in the HelpButton_Execute code, and the event handler for the KeyDown event.
It's the same method I use for every other modal window in the program, for submitting new tickets, adding equipment to the inventory, etc.
This problem only happens in the event handler, and only the first time the F1 key is pressed. The behavior is the same on every screen that has a help window.
My attempts to Google the problem were fruitless. Has anybody ever seen this behavior before?
That does sound very strange. I have to admit that I haven't seen anything like this myself with a modal window.
You don't mention where you're trapping the KeyDown key, so it's a bit hard to comment on that.
What I have seen sometimes, especially when doing something a little "different", is the error message not telling you the actual cause of the problem.
I would try wrapping the code with a dispatcher call, to make sure the call is being performed on the correct thread, as well as a try/catch to see if you can find the real cause of the error:
Private Sub YourClickHandler
Try
Me.Details.Dispatcher.BeginInvoke(
Sub()
OpenModalWindow("HelpWindow")
End Sub)
Catch ex As Exception
Me.ShowMessageBox(ex.Message)
End Try
End Sub
I hope that helps, or at least points you in the direction of a solution.
I have an application that sends the focus to other windows but those windows then don't automatically display themselves in the foreground, i.e. on top of all the other windows. Where can I configure the preferences of my window manager so that this is the default behaviour?
In particular I'm using the Ctrl-0 and Ctrl-Shft-0 shortcuts in the MATLAB IDE to move between the command window and the editor window and although the focus seems to be transferred the new window doesn't automatically redraw itself in the foreground.
Not sure of a key binding off hand that does it, but if you alt-click on a window (which allows you to drag a window) it should come to the front.
As codeDr suggests, MATLAB is also kind of bad about repainting its windows. If you draw to a figure while code is executing, the figure does not update unless you execute drawnow or have some similar pause in the execution to allow the GUI to repaint. Since we're talking about MATLAB, the figure command will also cause the indicated figure to come to the front (in fact, it's harder to get it to not come to the front). So you could do figure(gcf) to bring the current figure to the front, or save the figure number with h = figure; and then later do figure(h). Incidentally, if you want to switch current figures without switching focus, set(0, 'CurrentFigure', h) should set h to the current figure.
Your window manager (probably Metacity?) implements focus-stealing prevention so that rogue apps don't pop up windows that would disturb your typing. Matlab needs to raise its window, and give it the input focus with the correct timestamp. If this is being done from a KeyPress event handler, the timestamp for setting the input focus would be the timestamp from the KeyPress event (i.e. the timestamp of the user-generated event that caused a window to be raised/focused).
To politely give the input focus to a window, google for _NET_ACTIVE_WINDOW.
Usually when the window doesn't repaint, it means that the application's main application loop isn't running to refresh the window. Could it be that Matlab is doing some computation or disk activity when you are switching between windows?