android-fragments

Fragment declared target fragment that does not belong to this FragmentManager

我的未来我决定 提交于 2020-02-27 05:01:50
问题 I have made an activity A which has a fragment X in it. In fragment X, EditText item has on click event which opens fragment Y. This fragment displays a list of names. I press a name in the list, fragment Y closes and sends the selected name of to fragment X EditText. Here's the code I wrote: YFragment y = new YFragment(); y.setTargetFragment(x.class, code); getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.frame, y) .addToBackStack(null) .commit(); In fragment Y I

Fragment declared target fragment that does not belong to this FragmentManager

爷,独闯天下 提交于 2020-02-27 05:01:16
问题 I have made an activity A which has a fragment X in it. In fragment X, EditText item has on click event which opens fragment Y. This fragment displays a list of names. I press a name in the list, fragment Y closes and sends the selected name of to fragment X EditText. Here's the code I wrote: YFragment y = new YFragment(); y.setTargetFragment(x.class, code); getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.frame, y) .addToBackStack(null) .commit(); In fragment Y I

java.lang.IllegalStateException: Fragment already added

天涯浪子 提交于 2020-02-26 08:12:10
问题 I have a Problem with a Android App compiled and running with target SDK 4.3. The App has two Activities, a MainActivity which is also the Launcher Activity and a SecondActivity. Both are using Fragments. To Support older Devices also, the support lib is used. In the following scenario it comes to the "IllegalStateException: Fragment already added" Error. 1) Start the app -> MainActivity is shown 2) switch to the SecondActivity with an Intent 3) Press the Home Button 4) Wait a longer time

How to correctly make a fragment rotate

旧时模样 提交于 2020-02-25 02:51:32
问题 I am trying to create a fragment for an app that will be rotated before shown (so as to avoid changing to landscape and portrait because I wish to avoid the activity being created again). When the first fragment is shown (a list) the user selects an option, and then the second fragment is shown as if it was in portrait. To do this I have added in the xml file of the second fragment: android:rotation="90" However this does not seem to work correctly, it looks like the screen was drawn in

How to correctly make a fragment rotate

亡梦爱人 提交于 2020-02-25 02:50:27
问题 I am trying to create a fragment for an app that will be rotated before shown (so as to avoid changing to landscape and portrait because I wish to avoid the activity being created again). When the first fragment is shown (a list) the user selects an option, and then the second fragment is shown as if it was in portrait. To do this I have added in the xml file of the second fragment: android:rotation="90" However this does not seem to work correctly, it looks like the screen was drawn in

Ghost behavior when pausing activity while fragment replace transaction with custom animation is running

*爱你&永不变心* 提交于 2020-02-24 06:00:39
问题 I am using fragment transactions to switch between components on a button press. To make the overall experience better I added custom animations to animate the old fragment out to the left, and the new fragment in from the right. The code to start this transaction looks like this: supportFragmentManager.beginTransaction() .setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left) .replace(R.id.fragment_container, contentModel.contentFragment, CONTENT_FRAGMENT_TAG) .commit() The

ripple effect resumes after fragment back stack pop

ε祈祈猫儿з 提交于 2020-02-24 05:00:50
问题 I am using native Fragments and a fragment transaction with add() and hide() . When I go back to the original fragment with the back button, the ripple animation from android:background="?attr/selectableItemBackground" resumes from when I opened the fragment originally. How do I cancel an animation when hiding a fragment in a transaction? getFragmentManager().beginTransaction() .hide(this) .add(R.id.fragment_container, fragment) .addToBackStack(null) .commit() Edit: I am changing my app to

How to click button inside method Adapter in RecyclerView?

喜你入骨 提交于 2020-02-23 07:19:44
问题 I am working on stripe-terminal-android-app, to connect to BBPOS 2X Reader device, wanted to click-item from list,(recyclerView). I am trying to do: when list of devices appears(readers), I am checking if readers.size()==1 , then click first-device from list, else show recyclerView() ; I have very less experience in Android(coming from JS, PY), :) After going through debugger to understand flow of program-running, I used F8 key, or stepOver the functions one by one, and where value is

How to click button inside method Adapter in RecyclerView?

你离开我真会死。 提交于 2020-02-23 07:19:43
问题 I am working on stripe-terminal-android-app, to connect to BBPOS 2X Reader device, wanted to click-item from list,(recyclerView). I am trying to do: when list of devices appears(readers), I am checking if readers.size()==1 , then click first-device from list, else show recyclerView() ; I have very less experience in Android(coming from JS, PY), :) After going through debugger to understand flow of program-running, I used F8 key, or stepOver the functions one by one, and where value is

Viewpager tabs recreated?

与世无争的帅哥 提交于 2020-02-23 03:54:17
问题 I have implemented a NavigationDrawer with a few items in it. Every item represents a different Fragment and one of them has tabs. My problem is that every time I open this Fragment the tabs reloaded! and added to the previous tabs. Why is this happening and how can I solve it? This is the Fragment with the tabs: public class fragment_profilo_tabs extends Fragment implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; //