There is a RecyclerView with 2 ViewHolders, where the JSON object comes in, which has a list, which I actually display. But according to my idea, I should get two types of elements, instead of three. The first is TYPE_TEXTVIEW; The second is TYPE_EDITVIEW; and the third is all the rest. The third item in my list (pictured below) is displayed as "Not found".
We advised to remove (sort) this element from my list itself by creating a loop:
public void onResponse(Call<DropDown> call, Response<DropDown> response) { DropDown jsonResponse = response.body(); for(Groupss g :jsonResponse.getForm().getmGroupss()) { if (g.getmControls() != null && g.getmControls().size() > 0 && "type".equals(g.getmControls().get(0).getTitle())) { mList.add(g); } }
Please tell me how to remove an unnecessary element in the method?
if (mList.get(position).getmControls().size()>0)
is not satisfied for it, ormList.get(position).getmControls().get(0).getTitle()
does not match the strings fromcase
- Vladyslav MatviienkogetItemViewType()
, and see if I guessed correctly. - Vladyslav Matviienkoreturn temp;
writeLog.d("check","return " + temp + "; position = " + position);
- Vladyslav Matviienko