本文介绍了片段交易 - 未找到ID 0x7f090022视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图取代片段当我点击一个项目名单的事情是,我已经得到了同样的code 5型动物片段,它适用于所有的,只有在这个片段说:

It says the frame_container is not found... This is how I do the replace :

    Bundle bundle = new Bundle();
    android.support.v4.app.Fragment fragment = new DetallProductePerTipus();
    bundle.putString("titol", item.title);

    fragment.setArguments(bundle);

    getFragmentManager().beginTransaction()

            .replace(R.id.frame_container, fragment).commit();

I had problems with transaction with Fragments v4 and not v4, and then I tried also this :

   Bundle bundle = new Bundle();
   Fragment fragment = new DetallProductePerTipus();
    bundle.putString("titol", item.title);

    fragment.setArguments(bundle);

    getFragmentManager().beginTransaction()

            .replace(R.id.frame_container, fragment).commit();

but it still doesn't work...

What I'm doing wrong?

On the same Fragment I've got this code that makes a replace of a Fragment, I want the same but adding the Bundle.

android.support.v4.app.FragmentManager fm = getActivity().getSupportFragmentManager();
android.support.v4.app.FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.frame_container, new ListaProductosFragment());
ft.commit();
解决方案

Finally solved my problem doing this :

Bundle bundle = new Bundle();
bundle.putString("titol", item.title);
android.support.v4.app.FragmentManager fm = getActivity().getSupportFragmentManager();
Fragment fragment = new DetallProducteOffer();
fragment.setArguments(bundle);
fm.beginTransaction()
.replace(R.id.frame_container, fragment).commit();

这篇关于片段交易 - 未找到ID 0x7f090022视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 12:32