activity-finish

Android - Shared element transitions with calling activity finish()

假如想象 提交于 2019-11-30 00:13:40
问题 I'm working on making an application more Material and I'm just stuck on how to implement some shared element transitions. I have an activity A that starts another B and then calls finish() in order to remove it from the back stack. In my case I have an element I want to share between the two activities, but once it is passed from A to B, A no longer matters. If I don't call finish() after startActivity(ctx,intent, bundle) the exit/enter animation works perfectly. However, if I do call finish

Finish activity in dialog class

爱⌒轻易说出口 提交于 2019-11-29 09:29:25
In my MainActivity I call myDialog dialog = new myDialog(MainActivity.this); dialog.show(); myDialog is my own class where I customize the dialog. In the dialog is a button. I want that the MainActivity and the dialog finishes/dissappears when the button is pressed, because I start another Activity then. How can I say in the myDialog class, in the onClickListener , that the MainActivity should finish() ? Shortened code of my dialog: public class myDialog extends Dialog implements OnClickListener { void onClick() { Intent menu = new Intent(getContext(), menu.class); getContext().startActivity

How to finish() an Activity when Home button pressed

…衆ロ難τιáo~ 提交于 2019-11-29 06:40:25
For a complicated reason I need to be able to finish() my activities when the user presses the HOME button. The story here is that I have a homescreen widget that launches a different part of my application that has a completely transparent activity (so the homescreen keeps showing even though my activity is running). If the previous activities were terminated via Home button, they are brought to the foreground and obscure the home screen. Or as alternative, can I have the new activity somehow force finish() the previous activity? dylan murphy what about android:launchMode="singleTask" or

How to finish every activity on the stack except the first in Android

做~自己de王妃 提交于 2019-11-29 03:17:44
I'm porting an iPhone app to Android and I can't seem to find a means to pop each activity on the stack except the root activity. In objective-c I would do something like the below [navController popToRootViewControllerAnimated:YES]; Anyone know if I can effectively call "finish()" on each activity after some action? If you want to start one Activity, say, your homescreen, and remove every other Activity in your application's stack, you can use: Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Removes other Activities from stack

How to press back button in android programmatically?

北慕城南 提交于 2019-11-28 18:30:47
In my app I have a logout functionality. If user clicks logout it goes to home screen. Now I am exiting my app by pressing back button. But what I want is I need to exit automatically(i.e Programmatically) as same like as back button functionality. I know by calling finish() will do the functionality. But the thing is it goes to the previous activity. Tarun onBackPressed() is supported since: API Level 5 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { onBackPressed(); } } @Override public void onBackPressed() { //this is only needed

Angular js - detect when all $http() have finished

吃可爱长大的小学妹 提交于 2019-11-28 16:24:31
Ok i have tons of $http() calls all around the app code, i'm wondering is there any way / best practice to detect when all $http() around the app have finished ( success/error donesn't matter what they return, just need to know if finished )? So that i can show a loading gif until they are loading ? thanks Do it like this: angular.module('app').factory('httpInterceptor', ['$q', '$rootScope', function ($q, $rootScope) { var loadingCount = 0; return { request: function (config) { if(++loadingCount === 1) $rootScope.$broadcast('loading:progress'); return config || $q.when(config); }, response:

How to close the current fragment by using Button like the back button?

岁酱吖の 提交于 2019-11-28 16:09:43
I have try to close the current fragment by using Imagebutton. I am in Fragment-A and it will turn to the Fragment-B when I click the button. And when I click the button at Fragment-B , it will turn to the Fragment-C and close the Fragment-B. If I click the back button at Fragment-C , it will back to the Fragment-A. The code I have try is like the following camera_album = (ImageButton) view.findViewById(R.id.camera_album); camera_album.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { closefragment(); Fragment fragment = FileBrowserFragment.newInstance

Finish activity in dialog class

喜夏-厌秋 提交于 2019-11-28 03:01:30
问题 In my MainActivity I call myDialog dialog = new myDialog(MainActivity.this); dialog.show(); myDialog is my own class where I customize the dialog. In the dialog is a button. I want that the MainActivity and the dialog finishes/dissappears when the button is pressed, because I start another Activity then. How can I say in the myDialog class, in the onClickListener , that the MainActivity should finish() ? Shortened code of my dialog: public class myDialog extends Dialog implements

Is it a good idea to call finish() after starting a new Activity in Android?

随声附和 提交于 2019-11-27 15:51:52
问题 Like: startActivity(intent); finish(); Without calling finish() explicitly, onDestroy() is not called for the former Activity, and I run out of memory (OutOfMemory Exception). So, is it a good idea to call finish() explicitly to prevent OutOfMemory Exception? 回答1: When you start a new activity, the current activity is pushed onto the back stack of the current task. (You can change this behavior via flags and/or the manifest, but this is the default behavior.) When the user presses the back

How to finish every activity on the stack except the first in Android

坚强是说给别人听的谎言 提交于 2019-11-27 15:49:21
问题 I'm porting an iPhone app to Android and I can't seem to find a means to pop each activity on the stack except the root activity. In objective-c I would do something like the below [navController popToRootViewControllerAnimated:YES]; Anyone know if I can effectively call "finish()" on each activity after some action? 回答1: If you want to start one Activity, say, your homescreen, and remove every other Activity in your application's stack, you can use: Intent intent = new Intent(this,