爲什麼它不顯示任何自動更正我的數組有串自動完成文本視圖不工作
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Sentence");
alert.setMessage("type only words you taught him!!!");
// Set an EditText view to get user input
//final EditText input = new EditText(this);
//alert.setView(input);
// Get a reference to the AutoCompleteTextView in the layout
final AutoCompleteTextView textView = new AutoCompleteTextView(this);
// Get the string array
//String[] countries = getResources().getStringArray(R.array.countries_array);
// Create the adapter and set it to the AutoCompleteTextView
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mywords);
textView.setAdapter(adapter);
alert.setView(textView);
alert.setPositiveButton("Order", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value =textView.getText().toString();
String[] inputarray;
value=value.trim();
inputarray=value.split(" ");
playnum=new int[inputarray.length];
for(int j=0;j<inputarray.length;j++)
{
legit=0;
for(int i=0;i<mywords.length;i++)
{
if(info.choosetext[Integer.parseInt(mywords[i])].equalsIgnoreCase(inputarray[j])){
playnum[j]=Integer.parseInt(mywords[i]);
legit++;
}
}
if(legit==0)
break;
}
if(legit!=0){
playone=MediaPlayer.create(getBaseContext(), getResources().getIdentifier("word" + Integer.toString(playnum[0]), "raw", getPackageName()));
gottext=true;
}
}
});
alert.setNegativeButton("Dismiss", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
我希望它顯示陣列的建議和點擊它輸入到文本視圖,現在我說只是因爲我有太多的代碼並不能張貼
有其他人知道如何做到這一點沒有XML
我乞求幫助,我不在XML是在這個 – learning 2014-12-03 16:54:42