N
N
Neonoviiwolf2017-09-09 19:05:07
Java
Neonoviiwolf, 2017-09-09 19:05:07

How to override the method in AppCompatAutoCompleteTextView in such a variant?

Good, explain in an accessible way how to override the method differently.
What is

writeNameProductConsist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                    //бла-бла
                }
            });

everything is clear here.
But it would be convenient for me to transfer the writeNameProductConsist to the class itself, i.e.
public class ExpansionAutoCompleteTextView extends AppCompatAutoCompleteTextView implements TextWatcher {

    @Override
    public void setOnItemClickListener(AdapterView.OnItemClickListener l) {
        super.setOnItemClickListener(l);
        l.onItemClick(/**что тут писать?*/);
    }

I don't understand how to add the code there if possible

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2017-09-09
@Neonoviiwolf

If I understand correctly, do not write anything there. In the class constructor, just call

this.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                    //бла-бла
                }
            });

Throw out the redistribution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question