I want to set the text color and hint text color to the text in a android.support.v7.widget.SearchView which is not in ActionBar and not in Menu option.I have tried few ways mentioned in stackoverflow. But none of them is working.
int searchSrcTextId =getResources().getIdentifier("android:id/search_src_text", null, null);
EditText searchEditText = (EditText) searchView.findViewById(searchSrcTextId);
searchEditText.setTextColor(Color.WHITE);
searchEditText.setHintTextColor(Color.LTGRAY);
I tried the above code,but it is giving Null pointer exception at the setTextColor line.Any kind of help will be appreciated.Thanks in advance.