本文整理了Java中android.widget.AutoCompleteTextView.getAdapter()
方法的一些代码示例,展示了AutoCompleteTextView.getAdapter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AutoCompleteTextView.getAdapter()
方法的具体详情如下:
包路径:android.widget.AutoCompleteTextView
类名称:AutoCompleteTextView
方法名:getAdapter
暂无
代码示例来源:origin: rey5137/material
/**
* <p>Returns a filterable list adapter used for auto completion.</p>
* <p>Only work when autoComplete mode is {@link #AUTOCOMPLETE_MODE_SINGLE} or {@link #AUTOCOMPLETE_MODE_MULTI}</p>
*
* @return a data adapter used for auto completion
*/
public ListAdapter getAdapter() {
if(mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE)
return null;
return ((AutoCompleteTextView)mInputView).getAdapter();
}
代码示例来源:origin: square/assertj-android
public AutoCompleteTextViewAssert hasAdapter(ListAdapter adapter) {
isNotNull();
ListAdapter actualAdapter = actual.getAdapter();
assertThat(actualAdapter) //
.overridingErrorMessage("Expected adapter <%s> but was <%s>.", adapter, actualAdapter) //
.isSameAs(adapter);
return this;
}
代码示例来源:origin: stackoverflow.com
AutoCompleteTextView edtxInput = (AutoCompleteTextView)layout.findViewById(R.id.edtx_input);
edtxInput.setThreshold(2);
edtxInput.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View arg1, int position, long arg3) {
Console.debug(TAG, "view: " + arg1, Console.Liviu);
AutoCompleteTextView medtxInput = (AutoCompleteTextView)parent;
medtxInput.setText(((FormOption)medtxInput.getAdapter().getItem(position)).getDescription());
}
});
代码示例来源:origin: kaytat/SimpleProtocolPlayer
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus && mIPAddrText.getAdapter() != null)
mIPAddrText.showDropDown();
}
});
代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android
@Override
public void onFocusChange(View view, boolean focused) {
if (focused && mAutoCompleteEditText != null && mAutoCompleteEditText.getAdapter().getCount() > 0)
mAutoCompleteEditText.showDropDown();
}
});
代码示例来源:origin: kaytat/SimpleProtocolPlayer
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus && mIPAddrText.getAdapter() != null)
mAudioPortText.showDropDown();
}
});
代码示例来源:origin: TUM-Dev/Campus-Android
@Override
public void onResponse(@NonNull Call<List<ChatMember>> call,
@NonNull Response<List<ChatMember>> response) {
searchView.setError(null);
suggestions = response.body();
((MemberSuggestionsListAdapter) searchView.getAdapter()).updateSuggestions(suggestions);
}
代码示例来源:origin: TUM-Dev/Campus-Android
/**
* Clears everything from the last search.
*/
private void reset() {
suggestions = new ArrayList<>();
((MemberSuggestionsListAdapter) searchView.getAdapter()).updateSuggestions(suggestions);
searchView.setText("");
}
代码示例来源:origin: stackoverflow.com
public class myActivity extends Activity implements OnItemClickListener {
AutoCompleteTextView mEditTextInput;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mEditTextInput = (AutoCompleteTextView)layout.findViewById(R.id.edtx_input);
mEditTextInput.setOnItemClickListener(this);
}
public void onItemClick(AdapterView<?> parent, View arg1, int position, long arg3) {
Console.debug(TAG, "view: " + arg1, Console.Liviu);
mEditTextInput.setText(((FormOption)mEditTextInput.getAdapter().getItem(position)).getDescription());
}
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public AutoCompleteTextViewAssert hasAdapter(ListAdapter adapter) {
isNotNull();
ListAdapter actualAdapter = actual.getAdapter();
assertThat(actualAdapter) //
.overridingErrorMessage("Expected adapter <%s> but was <%s>.", adapter, actualAdapter) //
.isSameAs(adapter);
return this;
}
代码示例来源:origin: stackoverflow.com
AutoCompleteTextView tvSuburbs;
ArrayAdapter<Suburb> a = (ArrayAdapter<Suburb>) tvSuburbs.getAdapter();
tvSuburbs.setAdapter(null); // Remove the adapter so we don't get a dropdown
tvSuburbs.setText(s.name); // when text is set programmatically.
tvSuburbs.setAdapter(a); // Restore adapter
代码示例来源:origin: henrichg/PhoneProfilesPlus
private void filterOnString(String string) {
if (mAutoCompleteTextView.getAdapter() == null) {
mAutoCompleteTextView.setAdapter(mFilterAdapter);
}
mHideFilterSearchOnStart = false;
mFilterAdapter.getFilter().filter(string);
}
}
代码示例来源:origin: sytolk/TaxiAndroidOpen
@UiThread
void setCitiesAdapter(GeonameAdmin1[] admin1Cities, boolean isAscii) {
if (admin1Cities != null && citiesPicker != null) {
if (citiesPicker.getAdapter() == null || this.isAscii != isAscii) {
this.isAscii = isAscii;
/*String[] cities = new String[]{
"Бургас", "София", "Варна", "Пловдив", "Несебър", "Слънчев бряг", "Приморско", "Царево", "Созопол", "Разград", "Монтана", "Враца", "Добрич", "Русе", "Плевен", "Перник", "Пазарджик", "Ловеч", "Хасково", "Благоевград", "Габрово", "Кърджали", "Кюстендил", "Шумен", "Силистра", "Сливен", "Смолян", "Стара Загора", "Търговище", "Велико Търново", "Видин", "Ямбол",
"Burgas", "Sofia", "Varna", "Plovdiv", "Nesebar", "Sunny beach", "Primorsko", "Carevo", "Sozopol", "Razgrad", "Montana", "Vratsa", "Dobrich", "Ruse", "Pleven", "Pernik", "Pazardzhik", "Lovech", "Haskovo", "Blagoevgrad", "Gabrovo", "Kurdzhali", "Kyustendil", "Shumen", "Silistra", "Sliven", "Smolyan", "Stara Zagora", "Turgovishte", "Veliko Turnovo", "Vidin", "Yambol"
};*/
CitiesAdapter[] citiesAdapters = new CitiesAdapter[admin1Cities.length];
int i = 0;
for (GeonameAdmin1 geonameAdmin1 : admin1Cities) {
citiesAdapters[i] = new CitiesAdapter(geonameAdmin1, isAscii);
i++;
}
ArrayAdapter<CitiesAdapter> adapter = new ArrayAdapter<>(mActivity, R.layout.spinner_layout, citiesAdapters); //android.R.layout.simple_dropdown_item_1line
citiesPicker.setAdapter(adapter);
}
}
}
代码示例来源:origin: okleine/spitfirefox
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
//Store actual data from service adapter
View serviceView = getActivity().findViewById(R.id.txt_service);
if(serviceView != null) {
ListAdapter serviceAdapter = ((AutoCompleteTextView) serviceView).getAdapter();
if (serviceAdapter != null) {
int count = serviceAdapter.getCount();
String[] services = new String[count];
for (int i = 0; i < count; i++) {
services[i] = (String) serviceAdapter.getItem(i);
}
outState.putCharSequenceArray("services", services);
}
}
}
代码示例来源:origin: playerone-id/EosCommander
private void setupAccountHistory(){
// get abi when contract name item selected
mEtContract.setOnItemClickListener( (adapterView, view, position, id) -> {
ListAdapter adapter = mEtContract.getAdapter();
if ( (null != adapter ) && !StringUtils.isEmpty( (String) adapter.getItem(position)) ){
onContractEntered( (String) adapter.getItem(position) );
}
});
UiUtils.setupAccountHistory( mEtContract, mEtPermissionAccount );
}
代码示例来源:origin: playerone-id/EosCommander
private void setupAccountHistory(){
UiUtils.setupAccountHistory(mScope, mTvCode);
// when contract selected
mTvCode.setOnItemClickListener( (adapterView, view, position, id) -> {
ListAdapter adapter = mTvCode.getAdapter();
if ( (null != adapter ) && !StringUtils.isEmpty( (String) adapter.getItem(position)) ){
hideKeyboard();
mPresenter.onGetTableListClicked( (String) adapter.getItem(position) );
}
});
}
内容来源于网络,如有侵权,请联系作者删除!