How to Transition from ListFragment to ActionBarActivity

Asked 2 years ago, Updated 2 years ago, 38 views

I am worried about how to transition from ListFragment to ActionBarActivity.

Perhaps this part cannot be done by FragmentTransaction, so I think it is necessary to rewrite it. What should I do when I transition from ListFragment to ActionBarActivity?I would appreciate it if you could let me know in detail.

*Example is the ActionBarActivity class.

@Override
public void onListItemClick (ListViewl, View v, int position, longid) {
    super.onListItemClick(l,v,position,id);
    ExampleElement item=mItems.get(position);
    FragmentTransaction ft = getFragmentManager().beginTransaction();

    ft.setCustomAnimations(R.animator.slide_in_left, R.animator.slide_in_right);
    ft.replace(R.id.container, newExample());
    ft.addToBackStack (null);
    ft.commit();
}

android

2022-09-30 20:34

1 Answers

To transition to Activity, use startActivity() or startActivityForResult().

Intent=newIntent(getActivity(), ExampleActivity.class);
startActivity (intent);

Call startActivityForResult() from Fragment and
If you are using Fragment of SupportLibrary, be careful not to specify a value greater than or equal to 0xFFFF for the second argument of startActivityForResult().


2022-09-30 20:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.