片段交易 - 未找到ID 0x7f090022视图 [英] Fragment Transaction - No view found for id 0x7f090022

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

问题描述

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


  

java.lang.IllegalArgumentException异常:未找到ID 0x7f090022视图(info.androidhive.slidingmenu:ID / frame_container)的片段DetallProductePerTipus {3899b306#1 ID = 0x7f090022}


报告说, frame_container 找不到......这是怎么我做的替换:

 捆绑包=新包();
    android.support.v4.app.Fragment片段=新DetallProductePerTipus();
    bundle.putString(titol,item.title);    fragment.setArguments(包);    getFragmentManager()调用BeginTransaction()            .replace(R.id.frame_container,片段).commit();

我有问题,交易与片段V4 ,而不是 V4 ,然后我想也是这个:

 捆绑包=新包();
   片段片段=新DetallProductePerTipus();
    bundle.putString(titol,item.title);    fragment.setArguments(包);    getFragmentManager()调用BeginTransaction()            .replace(R.id.frame_container,片段).commit();

但它仍然无法正常工作...

我在做什么错了?

在同一个片段我这有code,使一个替换片段中,我想的一样,但添加捆绑

  android.support.v4.app.FragmentManager FM = getActivity()getSupportFragmentManager()。
android.support.v4.app.FragmentTransaction英尺= fm.beginTransaction();
ft.replace(R.id.frame_container,新ListaProductosFragment());
ft.commit();


解决方案

终于解决了我的问题,这样做的:

 捆绑包=新包();
bundle.putString(titol,item.title);
android.support.v4.app.FragmentManager FM = getActivity()getSupportFragmentManager()。
片段片段=新DetallProducteOffer();
fragment.setArguments(包);
fm.beginTransaction()
.replace(R.id.frame_container,片段).commit();

I'm trying to replace a Fragment when I click on a item List, the thing is that I've got the same code for 5 differents fragments and it works on all, only on this Fragment says :

java.lang.IllegalArgumentException: No view found for id 0x7f090022 (info.androidhive.slidingmenu:id/frame_container) for fragment DetallProductePerTipus{3899b306 #1 id=0x7f090022}

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视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆