tag:blogger.com,1999:blog-4023775337223455601.post886962158133523812..comments2024-02-17T15:03:14.887+05:30Comments on Vardhan Blog - My Experiences: Android: Solution to detect when an Android app goes to the background and come back to the foreground Using Application.ActivityLifecycleCallbacks and ComponentCallbacks2Vardhan DShttp://www.blogger.com/profile/06902854396009389430noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-4023775337223455601.post-33534952726265356532015-12-14T07:30:19.017+05:302015-12-14T07:30:19.017+05:30If you launch a generic intent and there isn't...If you launch a generic intent and there isn't any application which can handle it, the application will crash. Check this article from Google developers:<br />http://developer.android.com/guide/components/intents-filters.html#ExampleSendJiahao Liuhttps://www.blogger.com/profile/08711920392291942969noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-33648573859635320782015-12-07T10:54:00.901+05:302015-12-07T10:54:00.901+05:30if (stateOfLifeCycle.equals("Stop")) {
...if (stateOfLifeCycle.equals("Stop")) {<br /> wasInBackground = true;<br /> }<br /> super.onTrimMemory(level);<br /> Log.d(TAG, "onTrimMemory " + level);<br /><br />this don't works for me.<br /><br />onActivityPaused MainActivity always before onTrimMemoryAndrew Chanhttps://www.blogger.com/profile/15382204277040111032noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-11370825332831866892015-09-26T12:06:05.679+05:302015-09-26T12:06:05.679+05:30I'm new in android May i know,What are the dif...I'm new in android May i know,What are the difference between these and How it use in android code. OnTrimmemory(),System.gc()Finalize().Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-72856678471437580572015-08-06T18:20:10.581+05:302015-08-06T18:20:10.581+05:30you can directly override onbackpressed to handle ...you can directly override onbackpressed to handle the caseVardhan DShttps://www.blogger.com/profile/06902854396009389430noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-60807553652467674702015-08-06T10:50:41.042+05:302015-08-06T10:50:41.042+05:30Vardhan I have successfully implemented your code ...Vardhan I have successfully implemented your code but I want to avoid onBackPressed which too may call activity form background and I just want to fire event when the app actually goes to background by pressing home button or opening of other apps... Any help will save my lifeNabin Raj Pandeyhttps://www.blogger.com/profile/06834183784394905871noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-50806746045028020582015-04-23T00:14:46.249+05:302015-04-23T00:14:46.249+05:30Why are we not using TRIM_MEMORY_UI_HIDDEN ? why d...Why are we not using TRIM_MEMORY_UI_HIDDEN ? why do we have to keep track of life cycle . As of the previous commenters mentioned we cannot assure on onTrimMemory being called after onStop . Wanted to know if there is any downside in using TRIM_MEMORY_UI_HIDDEN Unknownhttps://www.blogger.com/profile/06255470766658117776noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-89788032995868633382015-03-03T22:56:10.498+05:302015-03-03T22:56:10.498+05:30There is no direct approach for below version...On...There is no direct approach for below version...Only way is having common super class and achieving...You can check this post too http://vardhan-justlikethat.blogspot.in/2013/05/android-solution-to-detect-when-android.htmlVardhan DShttps://www.blogger.com/profile/06902854396009389430noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-21784355435106530682015-03-03T09:52:14.663+05:302015-03-03T09:52:14.663+05:30Hello Vardhan, I like your way. But my application...Hello Vardhan, I like your way. But my application need to be compatible from API 8/9 . Can we use it for older version, is there any support library? I have found https://github.com/BoD/android-activitylifecyclecallbacks-compat. Did you tried it?<br />Anonymoushttps://www.blogger.com/profile/05752203002474245072noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-68933102129776809542015-03-03T07:00:11.804+05:302015-03-03T07:00:11.804+05:30The onStop method is called after the on trim meth...The onStop method is called after the on trim method so the checked state of lifecycle in onTrim is never "Stop" Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-15966037928150657892014-12-12T01:59:24.558+05:302014-12-12T01:59:24.558+05:30Thank you for sharing this.Thank you for sharing this.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-17607258676137537342014-03-27T20:43:19.168+05:302014-03-27T20:43:19.168+05:30Hi AnujaKanchan,
I am not getting the error/ exce...Hi AnujaKanchan,<br /><br />I am not getting the error/ exception you got.<br />If possible, provide me the source code you have tested.<br /><br />Regards<br />VardhanVardhan DShttps://www.blogger.com/profile/06902854396009389430noreply@blogger.comtag:blogger.com,1999:blog-4023775337223455601.post-88918747245539681232014-03-12T00:41:42.210+05:302014-03-12T00:41:42.210+05:30Hello. Your tutorial was really helpful to me. But...Hello. Your tutorial was really helpful to me. But I need your help at one instance. <br />In the mainActivity's button onClick, I have written the following code<br /><br />Intent intent = new Intent(Intent.ACTION_CALL);<br />intent.setData(Uri.parse("tel:" + "1234"));<br />startActivity(intent);<br /><br />Now, the problem is I get an exception: Performing pause of activity that is not resumed (MainActivity).<br /><br />I am completely perplexed as to why is this coming.<br />It seems that after the onStop, onPause is called which is not true ideally.<br /><br />Can you suggest me something onto this end?AKhttps://www.blogger.com/profile/13503454777111447296noreply@blogger.com