During testing of mgwt application in emulator, if we suddenly stop and go to home page in emulator and start the application again, it will directly load the last page where we were wokring. Why it is not resetting it to the first page?
In GWT on module function, I am always loading the default place. I need to explicitly go and remove data and then start application to proceed.
How to overcome this problem programatically? Do we have any reference for it? I have not used gwt-phonegap, it is just mgwt with GWTp framework application.
I think your application isn't stopped. I think it is running in background. If you bring it back to front, it shows the same screen again.
Related
Currently I am trying to build my school project in Android and I am afraid I have chosen a really difficult project to complete. I would ask if it is possible to open a 3rd party application in a small window within my application. When I try to start a 3rd party application via a button click, the application starts and I cannot go back to my application any more. I want to start another application IN my application, take a screenshot of it, and close this small window. I would kindly ask you to help me in this subject. Thank you very much in advance.
I would ask if it is possible to open a 3rd party application in a small window within my application
No, sorry.
I want to start another application IN my application, take a screenshot of it, and close this small window
You can start an activity via startActivity(). With user permission, you can take a screenshot of whatever is on the screen, by means of the media projection APIs. You cannot:
embed the UI of the other activity in yours
open the other activity in a "small window" (though the user could, using split-screen capabilities in Android 7.0+)
At the end of the day, I decided to use multiwindow. Adding the line below into my code, I made it to run in a small window. Then I was able to start the other activity in the big window.
Recently I noticed one thing in my app.
I created apk for my app say ABC.apk and copied to my device and installed it by clicking on it. After the installation got successfully completed, I got 2 options 'Done' and 'Open', the usual options we get after installation.
I clicked on 'Open' and run the app. I moved to some screen and I minimized the app and moved to someother app, when I click my ABC, it started from my first screen.
It was just fraction of seconds I moved back to it, hence it should not be killed though launched it like it is first time.
Few things I noticed I if I explicitly killed this first instance from background running apps and start the app again it is not giving me this problem, same if I click 'Done' instead of 'Open' it works fine.
Is there anyone who are facing same issue, or have some solution for it?
Thanks in advance.
Prajakta
The problem is the way that the app gets launched from the installer doesn't exactly match the way Android launches apps from the HOME screen. Because this, if you initially launch your app from the installer, when you then later launch the app again from the HOME screen, Android doesn't recognize that the app is already running and just creates a new instance of the root Activity and adds it to the existing task on top of whatever activities are already there.
This is why, if you kill the app and start it again from the HOME screen, you won't ever see this strange behaviour.
This is a nasty Android bug which has been around since the dawn of time and is still broken, even though countless issues have been opened about it and the behaviour is reproducible and well-documented.
See the following issues and questions:
https://issuetracker.google.com/issues/36941942
https://issuetracker.google.com/issues/36907463
https://issuetracker.google.com/issues/64108432
App restarts rather than resumes
Re-launch of Activity on Home button, but...only the first time
There is a workaround documented in my answer to
Re-launch of Activity on Home button, but...only the first time
Just some general comments that come to mind that you must consider that can cause problems.
If you are trying to deploy an apk, did you switch from debug to release before building it? Make sure you are doing a full release. Do a clean and rebuild while in release mode as well.
Did you sign the apk?
Make sure all the necessary (if any) permissions are set in the manifest that will be needed by your app, on the device.
Hope these help point you in a direction.
Mike
Well the question is that I have an app with multiple activities. The main activity runs several animations and the problem is that if I run the app and stay in the main activity everything is all right but if I go to another activity (the setting activity, for example) and come back to the main one, after some time the hole app begins to lag.
Any clue about why is this happenning? May the other activities keep running in background or something like that?
Thank you all.
As far as your scenario is concerned, try following
Set up proper navigation within your app.
If you keep closing and opening your activities (when your activity is still holding on resources), your memory usage keeps piling up. So make sure you release all resources like camera, or finish an animation before calling finish();
Try different android:launchMode options for your Main Activity /Home screen activity. (this depends on your app design)
In order to find who is calling your app to use more memory, try https://developer.android.com/studio/profile/investigate-ram.html
PS. You could've given more details like #Michiyo mentioned.
I am using Robotium for testing android applications and am interested in how to detect a situation when an external application activity (e.g. browser, camera, facebook) is being launched by tested app. There are several questions asking how to handle such situation, but all I need is to detect it, for example just log time when it's occurred. Is this possible using Robotium or simple Instrumentation?
BTW, I can't use the solution when system apps are being replaced by fake analogues, I can't even know what application (and when) will be launched, because the tests are random. (Yes, I know, it's a bad approach, but this is a project restriction).
See my answer here. The main idea is to detect current top Activity, which is Activity of external application. You can create Service, which will monitor top activities.
Anther way is to check when your activity looses focus. When it looses focus that means that the other external Activity has focus instead.
http://developer.android.com/reference/android/app/Activity.html#hasWindowFocus()
You can use Solo.waitForCondition() in conjunction with hasWindowFocus.
I started developing an app with Kivy for Android and managed to build and run an APK today.
Couldn't find a straight answer on how to handle my app being suspended and resumed by a user without going through the initialization/loading screen? Is there a special mechanism that will handle this?
It is rather annoying that every time I send the app to the background and bring focus back to it there is that loading screen popping up.
I have never used Kivy or developed for android, but I was able to find:
This
From the link:
If you just want your app to not be closed completely (so that it doesn't restart entirely with the splash screen etc. every time), you just have to add an on_pause method to your App class, and it should return True. You can also do any pre-pause stuff in this method. However, the app doesn't really keep running, it just keeps memory state.
If you want it to do computations in the background you can use Python-for-android.
Kivy has an on_pause and on_resume methods that you can use to handle these events. These are methods of the main App class that are called automatically for you.