onbackpressed

Override back press react native router flux

别说谁变了你拦得住时间么 提交于 2019-12-05 02:56:00
问题 I am using react native router flux in my react native app. I want to override the back button press event as I want to add confirmation popup before going back. I have searched a lot but all the links I found was for overriding hardware back button press of Android. I not only want to override the hardware back press but also want to override the back button press event in the navigation bar (for both Android and iOS). Please help me out here. Edit: I found one way to override the back press

Fragment PopBackStack

£可爱£侵袭症+ 提交于 2019-12-03 06:53:52
问题 I am getting a strange problem, while using Fragments and popping back them out. I have one Fragment Activity: Step1: I am attaching one Fragment in the onCreate of that Activity in the Starting named Fragment A as: This is the onCreate of Fragment Activity @Override protected void onCreate(Bundle savedBundleState) { super.onCreate(savedBundleState); setContentView(R.layout.activity_base_new); Fragement_Home home = new Fragement_Home(); FragmentManager manager = getSupportFragmentManager();

Fragment PopBackStack

走远了吗. 提交于 2019-12-02 20:32:36
I am getting a strange problem, while using Fragments and popping back them out. I have one Fragment Activity: Step1: I am attaching one Fragment in the onCreate of that Activity in the Starting named Fragment A as: This is the onCreate of Fragment Activity @Override protected void onCreate(Bundle savedBundleState) { super.onCreate(savedBundleState); setContentView(R.layout.activity_base_new); Fragement_Home home = new Fragement_Home(); FragmentManager manager = getSupportFragmentManager(); manager.beginTransaction().add(R.id.frameContent, home).addToBackStack("home").commit(); } Step:2 After

How to clear ListView on Fragment when back button pressed?

旧街凉风 提交于 2019-12-02 11:17:37
问题 All data from that ListView is provided by a CursorAdapter . Whenever I pressed back button and return to activity, then click on the activity to start my fragment , all previous data still there stacking on top of each other. 回答1: Make public a method in fragment which will clear your list and call that method from its parent activity's On onBackPressed using fragment's instance. 回答2: 1) Create an interface BackPressedListener : public interface BackPressedListener { void onBackPressed(); }

Undo the changes in listview onbackpressed

 ̄綄美尐妖づ 提交于 2019-12-02 09:43:15
I have a list view which contains list of products and on the click of the list item, list details gets open. The list item contains values like gross weight, net weight etc. On the top of the list item details page I have a cross button instead of back button which on click will open a dialog saying "Do you want to save the changes" and with the button yes or no. On pressing YES, I am able to save the changes in the list view but on pressing NO, am not able to undo the changes. Below is the code for showing the dialog: @Override public boolean onBackPressed() { final AlertDialog alert = new

How to clear ListView on Fragment when back button pressed?

假如想象 提交于 2019-12-02 04:41:24
All data from that ListView is provided by a CursorAdapter . Whenever I pressed back button and return to activity, then click on the activity to start my fragment , all previous data still there stacking on top of each other. Make public a method in fragment which will clear your list and call that method from its parent activity's On onBackPressed using fragment's instance. HaroldSer 1) Create an interface BackPressedListener : public interface BackPressedListener { void onBackPressed(); } 2) In your activity, you can override onBackPressed() : @Override public void onBackPressed() { List

Android reverse shared element transition on back after orientation change?

百般思念 提交于 2019-11-30 09:03:28
For shared element transition I am following this github project. It has 2 screens - one with recyclerview having number of cards & second the detail screen. As expected, it exhibits shared element transition of imageview & textview from recyclerview item to detail screen & reverse transition on back press. But, if user changes orientation on detail screen, & then presses back button then the reverse transition animation doesn't work. Looking at this video's frames between 2:49 to 2:57 it seems to be possible even after orientation change. Any idea on this? Edit: Please check this video for

Android reverse shared element transition on back after orientation change?

让人想犯罪 __ 提交于 2019-11-29 13:05:05
问题 For shared element transition I am following this github project. It has 2 screens - one with recyclerview having number of cards & second the detail screen. As expected, it exhibits shared element transition of imageview & textview from recyclerview item to detail screen & reverse transition on back press. But, if user changes orientation on detail screen, & then presses back button then the reverse transition animation doesn't work. Looking at this video's frames between 2:49 to 2:57 it

Activity navigation: custom animation with popEnter and popExit like fragments

南楼画角 提交于 2019-11-28 12:27:54
Changing activities with an animation is possible using the code below: Bundle animation = ActivityOptions.makeCustomAnimation(App.getContext(), R.anim.enter_from_right, R.anim.exit_to_left).toBundle(); startActivity(intent, animation); For fragments you can do something similar on FragmentTransaction: // ... transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left); // ... This works! But I'd like to have an animation when pressing back (pop from backstack). For fragments you simply add 2 anim resources (popEnter & popExit): transaction.setCustomAnimations(R.anim.enter

problems with Fragment onBackPress

て烟熏妆下的殇ゞ 提交于 2019-11-28 11:55:03
问题 in my navigation drawer there are 5 menu items.one of them is about us item.when I click on this item, I call AboutUsFragment and show it(its content is just a text).but when I click onBackPress, fragment is gone but its texts remains on my activity.how can I solve this problem?what`s it related to?! select item of navigation drawer in my activity: public void selectItem(int position) { Fragment fragment = null; switch (position) { case 0: if (!Constants.login_state) { fragment = new