When a button is clicked we get a view in the onClickListener method. Like:
Button btn = (Button) this.findViewById(R.id.btn);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
quickAction.show(v);
}});
How can we do the same with the Preference i.e, if i want to pass the View of the preference screen to some method ?
If you are referring to finding a preference in a PreferenceFragment/PreferenceActivity you can do
You won’t be able to get a view in the traditional sense of how you’re thinking but you will instead get a Preference object. You can call
getView (View convertView, ViewGroup parent)on the preference, however.