use of android.widget.AutoCompleteTextView in project android_frameworks_base by crdroidandroid.
the class AutoCompleteTextViewActivityPortrait method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.auto_complete_list);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
textView.setAdapter(adapter);
}
use of android.widget.AutoCompleteTextView in project LiveLessons by douglascraigschmidt.
the class MainActivity method addURLs.
/**
* Adds a List of URLs to the ListView to allow for variable
* number of URL Lists to process (i.e., variable number of
* iteration cycles by the ImageTaskGang).
*/
@SuppressLint("InflateParams")
public void addURLs(View view) {
// Create the new list from R.layout.list_item
AutoCompleteTextView newList = (AutoCompleteTextView) LayoutInflater.from(this).inflate(R.layout.list_item, null);
// Set the adapter to the given suggestions
newList.setAdapter(mSuggestions);
// Add the view and invalidate it so that the
// layout is redrawn by the framework
mListUrlGroups.addView(newList);
mListUrlGroups.invalidate();
// Set the "Run" button to visible
mRunButton.setVisibility(View.VISIBLE);
}
use of android.widget.AutoCompleteTextView in project double-espresso by JakeWharton.
the class SendActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.send_activity);
EditText editText = (EditText) findViewById(R.id.enter_data_edit_text);
editText.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
EditText editText = (EditText) view;
TextView responseText = (TextView) findViewById(R.id.enter_data_response_text);
responseText.setText(editText.getText());
return true;
} else {
return false;
}
}
});
final EditText searchBox = (EditText) findViewById(R.id.search_box);
searchBox.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
TextView result = (TextView) findViewById(R.id.search_result);
result.setText(getString(R.string.searching_for_label) + " " + v.getText());
result.setVisibility(View.VISIBLE);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(searchBox.getWindowToken(), 0);
return true;
}
return false;
}
});
AutoCompleteTextView autoComplete = (AutoCompleteTextView) findViewById(R.id.auto_complete_text_view);
String[] completions = new String[] { "Pacific Ocean", "Atlantic Ocean", "Indian Ocean", "Southern Ocean", "Artic Ocean", "Mediterranean Sea", "Caribbean Sea", "South China Sea", "Bering Sea", "Gulf of Mexico", "Okhotsk Sea", "East China Sea", "Hudson Bay", "Japan Sea", "Andaman Sea", "North Sea", "Red Sea", "Baltic Sea" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, completions);
autoComplete.setAdapter(adapter);
}
use of android.widget.AutoCompleteTextView in project android_frameworks_base by AOSPA.
the class PopupWindowVisibility method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.popup_window_visibility);
mFrame = findViewById(R.id.frame);
mHide = (Button) findViewById(R.id.hide);
mHide.setOnClickListener(this);
mShow = (Button) findViewById(R.id.show);
mShow.setOnClickListener(this);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mStrings);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
ArrayAdapter<String> autoAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.auto);
textView.setAdapter(autoAdapter);
}
use of android.widget.AutoCompleteTextView in project android_frameworks_base by DirtyUnicorns.
the class PopupWindowVisibility method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.popup_window_visibility);
mFrame = findViewById(R.id.frame);
mHide = (Button) findViewById(R.id.hide);
mHide.setOnClickListener(this);
mShow = (Button) findViewById(R.id.show);
mShow.setOnClickListener(this);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mStrings);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
ArrayAdapter<String> autoAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.auto);
textView.setAdapter(autoAdapter);
}
Aggregations