logcat 没有错误,但是建议列表不会显示我不确定我哪里出错了。我在警报对话框中夸大了自动完成视图。这是我下面的代码
reg_btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final String[] devplatforms =
{
"C",
"C++",
"Java",
"iPhone",
"Android",
"ASP.NET",
"PHP",
"Python",
};
AlertDialog.Builder adb = new AlertDialog.Builder(SettingsMain.this);
LayoutInflater inflater = SettingsMain.this.getLayoutInflater();
final View searchlayout = inflater.inflate(R.layout.search_friend, null);
adb.setView(searchlayout)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
AutoCompleteTextView friend_name;
friend_name = (AutoCompleteTextView) searchlayout.findViewById(R.id.friend_name);
friend_name.setThreshold(1);
friend_name.setAdapter(new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_dropdown_item_1line,devplatforms));
String name = friend_name.getText().toString();
Log.d( "ECHO" , "Pin Value : " + name);
return;
}
})
.setNegativeButton("Done", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
adb.show();
});