开发者

Transition to FragmentActivity

开发者 https://www.devze.com 2023-03-22 10:06 出处:网络
I can transition to a开发者_如何学Python Fragment class using the code below, but how do i transition to a FragmentActivity, using the same code.

I can transition to a开发者_如何学Python 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消