i have a problem with android if, this is my Code:
private String getCode = null,getIn = null,getOut = null,getBold = null;
if (getIntent().getExtras().getString("pos_code") != null){
getCode = getIntent().getExtras().getString("pos_code");
}
if (getIntent().getExtras().getString("pos_in") != null){
getIn = getIntent().getExtras().getString("pos_in");
}
if (getIntent().getExtras().getString("pos_out") != null){
getOut = getIntent().getExtras().getString("pos_out");
}
if (getIntent().getExtras().getString("pos_bold") != null){
getBold = getIntent().getExtras().getString("pos_bold");
}
if (response.body().get(i).getAcf().getPosCode().toString().contains(getCode.toString())
&& response.body().get(i).getAcf().getPosDInside().toString().matches(getIn.toString())
&& response.body().get(i).getAcf().getPosDOutsid().toString().matches(getOut.toString())
&& response.body().get(i).getAcf().getPosBBold().toString().matches(getBold.toString())) {
list.add(new Model(Model.IMAGE_TYPE
, response.body().get(i).getAcf().getPosCode()
, response.body().get(i).getAcf().getPosDInside()
, response.body().get(i).getAcf().getPosDOutsid()
, response.body().get(i).getAcf().getPosBBold()));
}
and its working But i want if one or more of 4 Strings was null the IF steel Working and give the results without considering the nulled string and match others
actually i want to say that: i want to get all of data that matched or contains the EditText from user and if there was naull just NOT compare the nulled one
Aucun commentaire:
Enregistrer un commentaire