Hidden DialogFragment gets shown again when activity is resumed - android-dialogfragment

I have a DialogFragment I manually hide it via this.dialog.hide(), if I put the app to the background, such as pressing the home button, and click the app again, it brings up the activity, but also shows the hidden DialogFrament. This is not the behavor I expect. I would like to still keep the DialogFragment hidden, and only show it whenever I need to by calling this.dialog.show(). The reason why not remove it is beause I want to keep its state and it is re-used for many times, the initilization is expensive.
Is there a way not showing the DialogFragment when the activity is resumed?

Related

The route.first page (MyHomePage) is updating even without a callback, function or notification listener

I can't really share code for this as it's for my entire ~large~ application, but is it normal for a flutter application's lower navigation stack to be updated when the current page is?
For example, in this page I have a standard form with a few TextFormFields:
Whenever I click on one to start typing the page sets state as expected, but by adding print("Update"); inside the build function of the bottom page of the navigation stack, I can see that page is being updated too. It happens on all pages I put on top of the first route page. I've also been experiencing that the home page gets slower as the app has been open for longer, could this be a cause for that problem too?

How to render a webview that will still running even though the parent widget screen is popped out in Flutter?

So in my app, I create an additional page. When that page is opened, it will guide a user through a series of steps, that ultimately open a webview pointing to a URL in backend, that generates an image to be saved to the server. The user doesn't need to know what's being drawn in the webview, so the webview can be set invisible (opacity = 0.0).
The image can only be generated by that web page (which is why I have to open it with webview). This is a client-side javascript and HTML5 canvas process that can't be done by server-side code alone. There's actually a web page that has to be opened. And all the Flutter code need to do is to open the webview component long enough for the image to be created and automatically saved into the server.
The problem is, the process may take dozens of seconds. In my case, it takes like 7-12 seconds. And the user may press back on the page that unfortunately will close the webview too and cancel the image generation and submission. I already added an infinite circular progress indicator, but apparently, from the early user tests, some users weren't patient enough to wait that long and already pressed back before the image is finished rendering.
My question is, how can I create a webview detached from the current screen, so that even after the current screen is closed, the webview will still be running in the background?
Currently, I use flutter_webview_plugin: ^0.3.11 for this. It allows for launching webview popup that's hidden. But when I close the page, the invisible webview popup also gets closed too.
Combine Offstage widget with custom pop logic (instead of popping back, just hide the webview by setting bool offstage to true).
As per Offstage docs:
A widget that lays the child out as if it was in the tree, but without
painting anything, without making the child available for hit testing,
and without taking any room in the parent.
Offstage children are still active: they can receive focus and have
keyboard input directed to them.
Animations continue to run in offstage children, and therefore use
battery and CPU time, regardless of whether the animations end up
being visible.
https://api.flutter.dev/flutter/widgets/Offstage-class.html

Presenter saves the textbox value in gwtp, gwt

I tried to develop a shopping cart application.
I am able to process the deal. but when the user click the fresh start after completing the deal the first page starts with the value which I have entered previously.
I am using gwtp, uibinders, I have back, cancel, next functionality in series of screens.
what to do to make sure the screen is blank for every new start of deal.
I don't know which design pattern you use, but usually a "view" keeps its state after it is hidden. When you show your view the second time, you have to reset the values of all fields (textboxes, inputs, etc.), or they will show their state from the previous time.

Key Listener called again and again if I click on Browser's back Button with Activity and Places in GWT

I am creating search page and I have use activity and places in GWT. I have used Key Listener so when user press Enter it redirect user on result page.
Problem is that when user use browser back button and again press enter Key Listener call twice same if user again click back button next time it will call trice and so on. Is there any solution for this?
You're probably adding your listener when activity starts but never remove it (e.g. when activity stops).
The full solution depends how you code your activity (do you reuse activity instances? do you have a separate view with activity acting as a presenter/controller? if so, is the view a singleton, or at list lives longer than the activity and can be reused by another activity instance? etc.)

Unable to access any widgets in an window

I have one GtkWindow with one GtkVBox and GtkEntry.
Some times it happens that i am unable to access buttons Buttons, lists, entries.
But i am able to add widgets to GtkVBox and it gets updated with new widgets too.
Looks like it loses Focus. i tries with setting focus but it does not helps.
What might be wrong.
You mention having a pop-up, in a comment. Is this pop-up modal, are you nesting calls to gtk_main(), or calling gtk_dialog_run()?
It sounds a bit as if GTK+ is considering the displayed UI to be "locked", which it also does when a modal dialog is open.
Try it without your timer and pop-up, see if it changes.