문제

I can transition to a Fragment class using the code below, but how do i transition to a FragmentActivity, using the same code.

FragmentActivity activity = new ABC(); // ABC is a FragmentActivity
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.details, activity); // replace errors out
fragmentTransaction.commit();
도움이 되었습니까?

해결책

You can't replace a view or a fragment with a FragmentActivity! A FragmentActivity is just an Activity and has been created for Android Compatibility support.

To summarize, an Activity can contains Fragments which can be dynamically replaced. The only way to navigate between Activities is by intent.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top