tags:

views:

26

answers:

1

Hai Friends, I have created an Edit text,in which the user type something , ForInstance: if the user types "tl" then i have to fire keytyped event and a search has to be done with the existing array and list the combination of tl, which the user was typed in the edit box, i am struggling on this, pls guide me on this.

@Override
    public boolean onKeyDown(View arg0, Editable arg1, int arg2, KeyEvent arg3) {
        // TODO Auto-generated method stub
        slist1.display(san_search);
        slist1.notifyDataSetChanged();
        return true;
    }
public String display(String temp)
    {
        String kemp="";
        String kemp_check;
        char[] kemp_find=new char[200];
        char[] bname_find=new char[200];
        for(int s=0;s<bname.length;s++)
        {
            kemp_find= bname[s].toCharArray();
            bname_find=temp.toCharArray();
            if(bname_find == kemp_find)
            {
                kemp+=bname[s];
                holder.text1.setText(kemp);
            }

        }
        return temp;
    }
}

thanks in Advance.

A: 

If you mean you want to have the list of items begining with "t" apear then there is a view for that autoCompleteTextView

Otherwise if you just want to do a search on your own data when the user is finished typing you could add a "Search" button, or subscribe to the onKeyDown event and for example check if the enter key was pressed and then do your search.

Jason
@Jason: but the problem is in the function invoked in KeyDown event.Pls refer again i posted the code of that function invoked on keydown event.
Tilsan The Fighter
@Tilsan The Fighter: could you explain what the problem is? I did not understand what is not working for you.
Jason
@Jason: Actually i have created an Editbox, for the user to type a value, if the user types ab, then i have to list out ab combination words from stored string array, but the problem is on both KeyDown event not fried and also i have written a method which list out the combination of words from the stored String Array.
Tilsan The Fighter
@Tilsan The Fighter: try using EditBox.setOnKeyListner instead of overriding onKeyDown. EDIT: have you written a custom view for this? It is not necessary...
Jason
@Jason: I have created EditBox using Xml code the code for creating EditBox is EditText search; search =(EditText)findViewById(R.id.EditText01);
Tilsan The Fighter
OK no pblem now add: search.setOnKeyListner(new OnKeyListner() { perform search or other stuff here });
Jason