网上找了其他解决方法也不行错误日志:java.lang.NullPointerException:Attempttoinvokevirtualmethod'android.view.Viewandroid.app.Activity.findViewById(int)'onanullobjectreferenceatcom.dmxy.fragment.ChannelFragment.onCheckedChanged(ChannelFragment.java:226)代码:@OverridepublicvoidonCheckedChanged(RadioGroupgroup,intcheckedId){if(json!=null){Gsongson=newGson();ChannelGameTypeBeanchannelGameTypeBean=gson.fromJson(json,ChannelGameTypeBean.class);Listdata=channelGameTypeBean.getData(); //TODO:三大游戏类型需改为动态加载数据ChannelGameTypeBean.DataBeandataBean=data.get(0);//初次获取王者荣耀数据1.英雄联盟2.王者荣耀3.绝地求生Listnav=dataBean.getNav(); ChannelGameTypeBean.DataBean.NavBeannavBean=nav.get(checkedId);//0.比赛1.解说2.战队3.专栏4.大神intnavId=navBean.getNavid();intsizes=data.size();Stringsize=String.valueOf(sizes);//传递获取分类游戏数据的POST参数BaseApplication.getApplication().getMap().put("navId",navId);BaseApplication.getApplication().getMap().put("size",size);}//TODO临时选中//TODO:首页和频道模块快速切换有bugRadioButtontempButton=getActivity().findViewById(checkedId);//这行空指针Log.d(TAG,"2222222222222");tempButton.setOnClickListener(this);}
繁星coding
千万里不及你
相关分类