以下链接解决了我的问题请试一试
通过使用 sqlite 数据库
http://saga-androidapplication.blogspot.in/2011/07/how-to-use-autocomplete-searchbox-in.html
源代码可以从
http://media0.webgarden.com/files/media0:4e0f5e93920fd.rar.upl/AutoCompleteSample.rar
2.非动态
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.MultiAutoCompleteTextView;
public class Autocomplete extends Activity {
/** Called when the activity is first created. */
String[] names =
{
"vasu","kamal","vimal","santhosh",
"prabu","prakash",
"bala","baskar",
"arjun","aravind",
"shankar","siva",
"mani","manickam",
"mohan",
"eswar",
"vikram",
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,names);
MultiAutoCompleteTextView textView = (MultiAutoCompleteTextView) findViewById(R.id.books);
//AutoCompleteTextView acTextView = (AutoCompleteTextView)findViewById(R.id.books);
//textView.setThreshold(1);
textView.setAdapter(adapter);
textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
//acTextView.setAdapter(adapter);
}
}
源码可以从
http://media0.webgarden.com/files/media0:4dd6666334cb7.rar.upl/Autocomplete.rar
首先将其作为项目导入并在两个设备中进行测试,然后尝试将其与您的应用程序集成