java.lang.IllegalArgumentException:找不到片段的id 0x7f0600cc的视图

时间:2013-11-13 11:27:39

标签: java android android-fragments

我在我的应用程序中实现了Fragment ViewPager,其中包含Custom布局。现在在ViewPager的自定义布局中有一个TextViewTextView的onClick我想用其他片段替换当前片段。让我们说与Fragment2。

我已经尝试替换,但是我想要加载片段的FrameLayout的资源ID给出错误。我已经检查了SO中的相关解决方案,但没有人帮助我。

请任何人都可以指导我这个错误。真的很感激和感激。

logcat的:

11-13 11:17:54.480: E/AndroidRuntime(3982): FATAL EXCEPTION: main
11-13 11:17:54.480: E/AndroidRuntime(3982): java.lang.IllegalArgumentException: No view found for id 0x7f0600cc for fragment OtherProfileFragment{40ceba28 #4 id=0x7f0600cc}
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:865)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1083)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:635)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1431)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.os.Handler.handleCallback(Handler.java:725)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.os.Looper.loop(Looper.java:137)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at android.app.ActivityThread.main(ActivityThread.java:5041)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at java.lang.reflect.Method.invokeNative(Native Method)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at java.lang.reflect.Method.invoke(Method.java:511)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
11-13 11:17:54.480: E/AndroidRuntime(3982):     at dalvik.system.NativeStart.main(Native Method)

这是我的代码,其中TextView onclick我试图加载片段。

    @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_feed_detail, container,
            false);
    m_tvProfileName = (TextView) v.findViewById(R.id.afd_tvProfileName);
    m_tvProfileName.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            FragmentManager m_mange = m_context.getSupportFragmentManager();
            FragmentTransaction fm = m_mange.beginTransaction();
            Fragment llf = new OtherFragment();
            Bundle m_bundle = new Bundle();
            m_bundle.putInt("Id", Id);
            llf.setArguments(m_bundle);
            fm.addToBackStack("Other");
            fm.replace(R.id.fragmentswitcherframe, llf); //This line throwing error
            fm.commit();
            getActivity().finish();

        }
    });

    return v;
}

0 个答案:

没有答案