activity-lifecycle Questions

16

My app shows a signup activity the first time the user runs the app, looks like: ActivitySplashScreen (welcome to game, sign up for an account?) ActivitySplashScreenSignUp (great, fill in this in...
Disfigure asked 14/12, 2009 at 4:15

5

Solved

Normally in a C or C++ program there's a main loop/function, usually int main (). Is there a similar function that I can use in android Java development?
Schmitt asked 8/7, 2009 at 17:59

7

Solved

As I understand it, an activity being destroyed is not equivalently to an activity being finished. Finished The activity is removed from the back stack. It can be triggered by the program (e.g....
Jocelin asked 4/2, 2013 at 5:36

3

Solved

Everything I've read says you can't call getWidth() or getHeight() on a View in a constructor, but I'm calling them in onResume(). Shouldn't the screen's layout have been drawn by then? @Override ...
Ranchod asked 9/4, 2014 at 19:18

1

Solved

Is the below exactly the same? lifecycleScope.launch {   whenStarted { // Do something } } and lifecycleScope.launchWhenStarted { // Do something } Or they do have some distinct purpose, henc...
Ludeman asked 26/12, 2021 at 7:38

3

Solved

In my simple android app I have 2 activities. In first activity(Main activity) I have override the ON STOP method. But when I go do the second activity on stop method of main_Activity is called. Wh...
Mead asked 17/4, 2014 at 17:33

4

My TextToSpeech works fine on the first run, but it doesn't work after the application has been closed using "back" key and reopened. The error is TextToSpeech: speak failed: not bound to TTS engin...
Bohol asked 22/12, 2016 at 13:40

5

Solved

I have three activity: - SplashActivity - MainActivity - PlayerActivity Of course the app starts with SplashActivity, then it starts MainActivity and closes. MainActivity in some moment starts ...

1

The task - :compileReleaseJavaWithJavac failed saying: The plugin flutter_plugin_android_lifecycle couldn't be built due to the errors: error: package androidx.lifecycle does not exist import and...

13

Solved

I'm developing android applications for a while, and followed a lot of posts about activity life cycle, and application's life cycle. I know Activity.finish() method calls somewhere in the way to ...

2

Apologies if this question sounds incredibly basic. I have an Activity that has an asynchronous network callback. The callback can execute after a user leaves the Activity. As a check I'd like to...
Fernandina asked 29/8, 2016 at 11:12

4

Solved

Here is how my app is laid out: onResume() user is prompted to login If user logs in, he can continue using the app 3. If the user logs out at any time, I want to prompt login again How can I a...

2

Solved

Solved (solution at the bottom) In my activity I need to read preferences and then override configuration. In constructor Context is not ready yet: Attempt to invoke virtual method 'java.lang.S...

3

Docs say: The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop(). Also in this one you can see: The onStart() call makes the activity visi...

4

Solved

I have created an application that has multiple pages and navigation from one to another represents a crucial flow. I don't want the user to be able to press the back button and escape the activity...
Submissive asked 27/5, 2013 at 8:48

7

Solved

When I open my app, an Activity is started, and inside its onCreate method I'm checking some conditions. If the condition is true, I finish my current Activity and open another one. The problem is:...
Procyon asked 4/8, 2015 at 19:45

6

I found my activities onStop() method will be called with a less than 10 seconds delay. I've never seen before this behavior. Note :- The activity is singleTop and it starts with Intent.FLAG_ACTIV...
Floorman asked 24/2, 2016 at 6:4

2

Solved

While Learning Activity LifeCycle in Android, I am confused about these two methods. I tried to implement both of them separately and are working fine. So, What's the difference between these two t...
Papke asked 18/4, 2020 at 18:12

3

One of the classes I've written needs to react when the following Activity events occur: onStart() onPause() onResume() onStop() I can react to those on the Activity itself: public class Activ...
Desultory asked 1/4, 2011 at 0:54

3

As we know, the default flow in Android for such scenario is calling the activity's respective onSaveInstanceState, onStop, onDestroy methods before releasing the reference to the Activity object. ...
Supersonics asked 5/8, 2013 at 8:44

1

Solved

I have alway used onCreate method inside my Activity lifecycle to start or restore from a saved state, but recently found that there is another onCreate method which contains a PersistableBundle: ...
Merely asked 4/11, 2016 at 13:50

3

Solved

For Acitivity there is already a method called onSaveInstacestate(Bundle) which used to store the data of activity which is overridden method. As i see, there are two different onSaveInstanceState...
Zipnick asked 25/5, 2016 at 5:58

13

Solved

I have a simple activity that loads a bitmap in onCreate. I find that if I rotate the device I can see from the logs that onCreate called again. In fact, because all instance variables are set to d...
Unfeigned asked 1/10, 2011 at 6:52

3

Solved

There are two buttons, button A starts another activity inside its onClickListener using simple Activity.startActivity() method, button B does some other work inside its onClickListener. When I cl...
Navarino asked 14/7, 2016 at 7:46

3

Solved

I am building an Android Java class which implements the LifecycleObserver interface. This is the constructor: public MyObserver(AppCompatActivity activity) { this.mActivity = new WeakReference...
Thermistor asked 5/12, 2017 at 15:4

© 2022 - 2024 — McMap. All rights reserved.