I would like to know how to compare texts of items from a recyclerView in android.
And if the texts are equal , make the item text below GONE .
public void pegarTexto (){
TextView um = (TextView) mRecyclerView.findViewHolderForItemId(mAdapter.getItemId(-1)).itemView.findViewById(R.id.nomePais);
TextView dois = (TextView) mRecyclerView.findViewHolderForItemId(mAdapter.getItemId(0)).itemView.findViewById(R.id.nomePais);
String pais1 = um.toString();
String pais2 = dois.toString();
if (pais1 == pais2){
dois.setVisibility(View.GONE);
mAdapter.notifyDataSetChanged();
}
In the above image, items 2 and 3 have the same name as item 1, so they would be invisible (GONE).
The image below shows how it should look.