草庐IT

null-test

全部标签

android - 在 fragment 中调用 getTag() 时总是返回 null

我有一个问题,因为当我在fragment中调用它时,getTag()方法返回null,fragment是我创建的ViewPager选项卡布局的一部分。代码importjava.util.ArrayList;importandroid.os.Bundle;importandroid.support.v4.app.Fragment;importandroid.support.v4.app.FragmentTransaction;importandroid.view.LayoutInflater;importandroid.view.View;importandroid.view.ViewG

android - Plus.PeopleApi.getCurrentPerson 返回 null

我目前正在开发我的应用中的GooglePlus登录功能。我像下面这样创建了GoogleApiClient构建器Plus.PlusOptionsoptions=newPlus.PlusOptions.Builder().addActivityTypes("http://schemas.google.com/AddActivity").build();myGoogleApiClient=newGoogleApiClient.Builder(this).addConnectionCallbacks(this).addOnConnectionFailedListener(this)//.add

android - ListView getChildAt() 返回 null

我一直在做一个android项目,但遇到了一个问题。我用谷歌搜索但没有找到答案。在我的项目中,有一个名为viewsurahfragment的fragment,它包含一个id为lv_showquran的ListView。我想在指定索引处突出显示ListView的View。我正在使用listview.getchildat()但它返回null值。这是viewsurahfragment的代码。发出不相关的函数。publicclassViewSurahFragmentextendsFragment{privateListViewlistView;privateintcurrentSurah;pr

java.lang.IllegalArgumentException: Cannot pass null or empty values to constructor at org.springf

 java.lang.IllegalArgumentException:Cannotpassnulloremptyvaluestoconstructor   atorg.springframework.security.core.userdetails.User.(User.java:113)   atorg.springframework.security.core.userdetails.User$UserBuilder.build(User.java:535)   atcom.example.mz.spingsecurity_jwt_deepstudy.SpingsecurityJwtD

android - View.findViewById() 返回 null

我有这个代码:privatevoidinflateMenu(){if(menu==null){mFanView=(LinearLayout)findViewById(R.id.fanView);finalViewv=LayoutInflater.from(getContext()).inflate(R.layout.sidemenu,mFanView);menu=(MenuView)v.findViewById(R.id.listViewMenu);}menu.setColors(backgroundColor,selectedColor,unselectedColor);}调试时,v

android - Intent 始终为 null onStartCommand

我有以下代码@OverridepublicintonStartCommand(Intentintent,intflags,intstartId){if(intent!=null){Log.i("INTENT",intent.getAction().toString());}returnSTART_STICKY;}但它总是在线返回NullPointerException:Log.i("INTENT",intent.getAction().toString());为什么?我在上面检查“intent”变量是否不为空。如果是这种情况,请执行以下代码。但我仍然遇到nullpointerexcep

java - Android:当我传递 Null 时,构造函数是不明确的,但当我传递分配给 Null 的变量时则不是

这个问题在这里已经有了答案:Howtodomethodoverloadingfornullargument?(7个答案)关闭8年前。我写了下面的语句来创建一个ArrayAdapter,ArrayAdapterarrayListAdapter=newArrayAdapter(getActivity(),R.layout.fragment_result_titles,R.layout.row_listview,arrayList);但是我得到了构造函数调用不明确的错误。我理解传递null时,不清楚ArrayAdapter(Contextcontext,intresource,inttext

java - 使用 RxJava2 时出现错误 "Callable returned null"

我在我的android项目中使用RxJava2。我正在使用以下代码创建ObservablepublicObservableloadAlbumFromAlbumId(finalStringalbumId){returnObservable.fromCallable(newCallable(){@OverridepublicAlbumDetailscall()throwsException{AlbumDetailsalbumDetails=getAlbumDetails(albumId);returnalbumDetails;});}从observable中,我在DisposableObs

当仅修改实体字段OBJ并且其余字段不应为null时,如何更新Hibernate实体记录

此代码还有其他不同的解决方案。对于每个POJO类,我们都必须检查来自浏览器的修改数据,我们将仅存储修改后的数据到数据库中。请参阅下面的BillingTaxOBJ来自浏览器,该浏览器已更新数据,并从数据库中检索BillingTaxDBobjectOBJ,我们将检查是否需要更改更新的数据如果POJO类有20个字段,如果Pojo类有5个字段,我们必须编写20个字段,如果条件,我们必须写5个字段是否修改了检查WATER数据的条件,或者是否还有其他最简单的方法?@OverridepublicBillingTaxupdate(BillingTaxbillingTax)throwsDataInsuffici

android - 为什么 (ListView)findViewById 返回 null?

帮助!我真的很欣赏StackOverflow和它在过去几个月里的贡献者。我有很多问题,我在这里找到了答案......但是这个我似乎无法在任何地方找到......我是Java和Android的菜鸟,我一直在努力弄清楚这个出去几天。出于某种原因,我有一个名为fileList的ListView对象,它返回null...一切都编译得很好,但是当我尝试使用fileList时我得到了一个NullPointerException...我已经能够将它隔离到它的声明中:ListViewfileList=(ListView)findViewById(R.id.open_ListView);但我终究无法理解