以下のコードに関する私の問題:
オートコンプリートは適切に機能し、電話番号と名前が表示されましたが、選択後にテキストビューを 1 つ入力するだけで済みます。
お願いします。
public class SendingSMSActivity extends Activity{
private int mCount;
private AutoCompleteTextView actv;
private ArrayList<String> mcurrentssFistLastName_PhoneList = null;
// private ArrayList<String> mcurrentssFistLastNameList = null;
AutoCompleteTextView PhoneNumberAutoComp;
MultiAutoCompleteTextView PhoneNumberMultiAutoComp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sending_sms_activity);
PhoneNumberAutoComp=(AutoCompleteTextView)findViewById(R.id.aCT_phone_number);
PhoneNumberMultiAutoComp=(MultiAutoCompleteTextView)findViewById(R.id.multiCompTextView);
ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,init());
PhoneNumberAutoComp.setAdapter(adapter);
PhoneNumberAutoComp.setThreshold(1);
PhoneNumberMultiAutoComp.setAdapter(adapter);
PhoneNumberMultiAutoComp.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
private ArrayList<String> init(){
mcurrentssFistLastName_PhoneList = new ArrayList<String>();
//mcurrentssFistLastNameList = new ArrayList<String>();
InnerDB db = new InnerDB(SendingSMSActivity.this);
final ArrayList<String> sPhoneList = db.getAllPhoneNumber();
final ArrayList<String> sFirstLastNameList = db.getAllSFirstName();
mCount = sPhoneList.size();
for(int i = 0; i < mCount; i ++){
mcurrentssFistLastName_PhoneList.add(sFirstLastNameList.get(i) +" " +sPhoneList.get(i));
//mcurrentssFistLastNameList.add(sFirstLastNameList.get(i));
}
return mcurrentssFistLastName_PhoneList;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
return super.onOptionsItemSelected(item);
}
@Override
protected void onResume() {
super.onResume();
}
}