back

Android: onSaveInstanceState in Back button

妖精的绣舞 提交于 2019-12-04 04:00:51
问题 I am developing an application in which i am overriding the back button. I created a check box. On click of which i am calling intent for: startActivityforResult(); And also maintaining the state of activity as : @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); savedInstanceState.putBoolean("checkbox", checkbox.isChecked()); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super

Close app when hitting back button on android

跟風遠走 提交于 2019-12-04 03:42:10
So my login Activity is the first screen you see. When you hit the back button, it exits the app, good. So I open up the app again. After logging in, I am now in my main Activity. How do I make it so when I hit the back button now, it exits the app rather than going back to the login Activity? When you push the new activity, call finish() on the previous, otherwise it will remain on the stack, therefore appearing when you hit back and pop the current activity. Hope that helps. try this one @Override public void onBackPressed() { super.onBackPressed(); finish(); } 来源: https://stackoverflow.com

UINavigationBar: intercept back button and back swipe gesture

萝らか妹 提交于 2019-12-03 20:14:48
I have a UINavigationBar that intercepts the back button tap that alerts the user if there are unsave changes. This is based on the solution presented in UINavigationController and UINavigationBarDelegate.ShouldPopItem() with MonoTouch using the UINavigationBarDelegate protocol and implementing - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; Now, iOS7 has introduced the swipe-to-go-back gesture, and I'd like to intercept that as well, but can't get it to work with the solutions I've found so far, namely using [self.interactivePopGestureRecognizer

Service with Overlay - catch back button press

柔情痞子 提交于 2019-12-03 17:28:43
问题 How can i do that? Current solution I launch a transparent activity, that catches the back press, forwards it to my service and closes itself afterwards. But this activity will be visible in the current running activities and therefore it's not a very beautiful solution. Solutions seen I've seen an app that does catch the back press in a service - without an activity that catches the back press. If I show the current running activities, there is nothing from this app. Question How can this be

Modify iframe.src without entry to history object

你。 提交于 2019-12-03 15:00:37
I have an iframe in my web page. I modify the src property via javascript like so: document.getElementById('myiframe').src = 'http://vimeo.com/videoid1'; document.getElementById('myiframe').src = 'http://vimeo.com/videoid2'; document.getElementById('myiframe').src = 'http://vimeo.com/videoid3'; However, everytime I do this, it's logged into the browser's history. So everytime I press back in the browser window, the iframe content goes from videoid3 to videoid2 to videoid1. If I press back again, the entire page goes back. I would like to modify the iframe src with javascript WITHOUT logging an

Is there an onBackPressed() alternative for a service?

泄露秘密 提交于 2019-12-03 11:58:26
I know that services cannot implement Back key press and I understand the rationale. But there is an app called SideBar (on Play Store) that reacts to back key presses. It is a service that adds a view as system overlay and removes the view when the back key is pressed. Can anybody explain how this is done? Here is another app that does it well. I have scoured the web, but have not found a solution to this problem. Any ideas? It is probably done using system alert windows - so the service creates and manages a window that is added to the window manager, which has a custom callback set on it.

Possible bug with <select><option> value modification and Back button on Chrome

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 11:48:56
问题 Chrome Version (type about:Version 28.0.1491.0 canary and 26.0.1410.65 Google Chrome): Operating System (Mac OS X Mountain Lion): The problem only occurs with Chrome Canary and regular Google Chrome. There is no issue with Firefox, Safari nor IE9 (Windows tested) latest versions. The code below changes all the stateBill values to be the same as the text values. Then submit it to another page and click Back button of browser page. The selected option is NOT visible (ie it shows blank) on the

Back to the App after call

…衆ロ難τιáo~ 提交于 2019-12-03 08:47:07
i'm trying to make a phone call from the app and I want it to return back to the app after the call i asked that question in this forum but i didn't understand the answer How to make a phone call in android and come back to my activity when the call is done? public void call() { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:048598077")); getContext().startActivity(callIntent); } catch (ActivityNotFoundException activityException) { Log.e("dialing-example", "Call failed", activityException);} finally { EndCallListener callListener = new

Curing the “Back Button Blues”

别来无恙 提交于 2019-12-03 06:25:50
问题 Ever stumbled on a tutorial that you feel is of great value but not quite explained properly? That's my dilemma. I know THIS TUTORIAL has some value but I just can't get it. Where do you call each function? Which function should be called first and which next, and which third? Will all functions be called in all files in an application? Does anyone know of a better way cure the "Back Button Blues"? I'm wondering if this will stir some good conversation that includes the author of the article.

Android - Simulate Back Button

这一生的挚爱 提交于 2019-12-03 05:22:01
问题 When i press a button in my app, I need to return to the last activity. Any ideas? 回答1: Calling finish() from the activity you want to end should take care of this. Edit many years later: This still works, but it's a bit of a heavy-handed approach. When I originally posted this, Fragments didn't exist, and (as several commenters have pointed out) this doesn't work quite the same way when there are Fragments involved. There are better approaches now if you're using Fragments. 回答2: Just for