How to add testview when touching a letter on right alphabet panel as shown in images? Could you please help me? Below is my code.
In details, I am looking for an e
I have displayed the list inside a fragment, if you want to display in main activity then you can pass this, instead of getActivity()
//method to display the side indexed scroll list of alphabets
public void displayAlphabetsList() {
final List listOfAlphabet = new ArrayList<>();
for (int i = 0; i < 26; i++) {
char alphabet = (char) (ASCII_VALUE_OF_A + i);
listOfAlphabet.add(String.valueOf(alphabet));
}
ArrayAdapter adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, listOfAlphabet);
alphabets_List_View.setAdapter(adapter);
alphabets_List_View.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
///scroll the recycler view to that position where matching letter was found
int positionToScroll = 0;
for (int i = 0; i < mContacts.size(); i++) {
if (mContacts.get(i).getFirstName().startsWith(listOfAlphabet.get(position)))
break;
else
positionToScroll++;
}
recyclerView.scrollToPosition(positionToScroll);
}
});
}