android-lifecycle

What does onStart() really do? - Android [duplicate]

拟墨画扇 提交于 2019-12-04 20:00:19
This question already has an answer here: Difference between onCreate() and onStart()? [duplicate] 2 answers I have been wondering for some time about the exact role of onStart() function in android life cycle. Most of the resources on net just say - it is called just before your activity becomes visible on the screen. But the applications that I have made so far I have never used onStart(). I do all my initialization in onCreate() itself. All other states in android life cycle have some or the other significance but the role of onStart() is not very clear. Are there any specific things that

windowIsTranslucent changes lifecycle, but error occur when entering lock screen

為{幸葍}努か 提交于 2019-12-04 16:49:09
I'm experiencing that <item name="android:windowIsTranslucent">true</item> is changing the way Android Lifecycle is handled. I guess it's doing that because if the window is translucent, you can still see the underlaying activity. Let's call it activity A. Let's go through the following example where we have another activity on top of activity A. This other activity is called B. Activity A Started - This activity is the first activity Activity A Stopped - Now you start activity B. Activity B Started - This activity has windowIsTranslucent set to false. Hence we can't see anything of activity A

NsdManager doesn't stop service discovery

拜拜、爱过 提交于 2019-12-04 16:07:47
问题 In Android app that I'm currently developing, I want to connect do zero-config networks using NsdManager . I managed to run network service discovery and connect to the desired network, but after stopping discovery NsdManager thread is still running. This leads to the situation when after a few screen rotations there are many NsdManager threads that are browsing for a connection. When any network is available, device tries to synchronize many times, so every NsdManager is still active,

Crash upon screen being unlocked

♀尐吖头ヾ 提交于 2019-12-04 15:52:14
My app runs fine besides when the user stops using their phone long enough for the screen to lock, when they unlock it the app crashes and im a bit clueless as to why. Here is the error: here is the lazy adapter: package com.buhz.helpers; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android

Having One Instance Of Activity

微笑、不失礼 提交于 2019-12-04 15:42:37
问题 I have a problem with Activity navigation and the back stack and I was hoping you could clear it up for me. The Problem Root Activity >>> SecondActivity >> HomeButton This then takes me to the home page and from there I select... Gmail >> Message >> Open attachment in my application >> ImportActivity >> RootActivity The outcome is a new task being started and another instance of my application being used. This is unacceptable as I don't want two separate tasks running I only want one. The

Android life cycle which event fired only once during the life cycle?

这一生的挚爱 提交于 2019-12-04 15:20:00
I have read some blogs and visited some site. I want to know which event fired only one time during the life cycle. After reading blogs I realize that onCreate() method is fired only once during the life cycle. I don't know I am right or wrong. Now my problem is that I want to fired any event which fired one time only if I change the landscape orientation or portrait orientation than this event not fired means after starting activity if user change the orientation than event not fired. I want to know which event fired only one time after starting Activity. this onCreate() onCreate and

Android Application class lifecyle documentation

China☆狼群 提交于 2019-12-04 12:18:39
问题 I'm trying to find the official documentation about the Android Application class lifecycle. Apparently, for what I found on StackOverflow here and here the Application class can be killed if the system needs memory. Even this tutorial says so. But few things irritates me a bit about this: I can't find an official documentation telling me that yes, the Application class can be killed on low memory. I can't find any official diagram representing the Application lifecycle neither. I can't find

Activity return to Portrait when Screen is Locked

99封情书 提交于 2019-12-04 11:44:34
Related questions: https://stackoverflow.com/questions/15648713/strange-behaviour-while-screen-lock-in-landscape This is a strange behaviour i got in my Activities. Portrait mode (It's normal) Press screen lock, Activity: onPause() ; Unlock the screen, Activity: onResume() . Landscape mode (It's strange) Press screen lock, Activity: onPause() -> onStop() -> onDestroy() -> onCreate() -> onStart() -> onResume() which loads the Portrait layout; Unlock the screen, Activity: onPause() -> onStop() -> onDestroy() -> onCreate() -> onStart() -> onResume() and loads the Landscape layout. What I expect

Lifecycle when calling the fragment replace or open new activity?

旧巷老猫 提交于 2019-12-04 10:19:06
The is an fragment that display the video. This fragment can either 1) open a new activity on click button 2) replace with another fragment by calling fragmentManager.beginTransaction().replace(R.id.container, f).addToBackStack(tag).commit(); for the 1) case , I would like to call player.stopPlayBack() to stop the video playing at backing And for the 2) case , I would like to call player.stopPlayBack() and player.release() to terminate the player The problem is , what event I should call for the case 1) and 2)? I try using onPause or onStop but both of them seems has not fired. How to fix it?

Nexus 5 going to sleep mode makes activity life cycle buggy

给你一囗甜甜゛ 提交于 2019-12-04 10:07:50
I have a strange behavior on the Nexus 5 when going in and out to the sleep mode. It kills and relaunchs the app in a really strange way. I show you the log: Going into sleep mode (pressing the power button) 17.005: E/MotherActivity(28940): onPause called 17.025: E/MotherActivity(28940): onStop called 17.315: E/MotherActivity(28940): onDestroy called 17.365: E/GameTuto1Activity(28940): MainActivity Constructor called 17.365: E/MotherActivity(28940): onCreate called 17.695: E/MotherActivity(28940): onStart called 17.705: E/MotherActivity(28940): onResume called 17.705: E/MotherActivity(28940):