Question

I am developing an android app for a Korean client. I have to search a data according to key press, like, if I press A then all the data who started from A show in listview where data come from a web service in listview. Is it possible?

If yes, then how to do it. If possible give me some code or link which I can use?

Thanks.

Was it helpful?

Solution

At the area where getData() is called in @Syam's code, fetch the new data according to the text entered in the edit text, put it in the array that has the source of ListView, don't forget to call setDataSetChanged() on the adapter in the end.

OTHER TIPS

Yes its possible.You can add TextChangedListener on your edittext and in the onTextChanged event get the date from the webserver as json or xml and parse that data and show the data in a listview.

edittext.addTextChangedListener(textWacther);
final TextWatcher textWacther = new TextWatcher() {
        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before,
                int count) {
            getdata();

        }

    };

Getting the data from webserver this question might be helpful for you How to connect to a Remote Database with Webservices?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top