当前位置: 首页>>代码示例>>Java>>正文


Java AutoCompleteTextView.setText方法代码示例

本文整理汇总了Java中android.widget.AutoCompleteTextView.setText方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteTextView.setText方法的具体用法?Java AutoCompleteTextView.setText怎么用?Java AutoCompleteTextView.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.AutoCompleteTextView的用法示例。


在下文中一共展示了AutoCompleteTextView.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setting = new Setting(this);
    setContentView(R.layout.activity_setting);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(getResources().getString(R.string.settings_title));

    AutoCompleteTextView inputTakeMeHome = (AutoCompleteTextView) findViewById(R.id.input_take_me_home);
    inputTakeMeHome.setAdapter(new StationAdapter(this, R.layout.autocomplete_item));
    inputTakeMeHome.addTextChangedListener(new TextWatcherAdapter() {
        @Override
        public void afterTextChanged(Editable e) {
            setting.saveSettings(R.string.setting_key_take_me_home, e.toString());
        }
    });
    inputTakeMeHome.setText(setting.getSettings(R.string.setting_key_take_me_home, ""), false);
    initSettingSelection(R.id.cb_train, R.string.setting_transportation_train);
    initSettingSelection(R.id.cb_tram, R.string.setting_transportation_tram);
    initSettingSelection(R.id.cb_bus, R.string.setting_transportation_bus);
    initSettingSelection(R.id.cb_boat, R.string.setting_transportation_ship);
    initSettingSelection(R.id.cb_firstclass, R.string.setting_classes_first);
    initSettingSelection(R.id.cb_secondclass, R.string.setting_classes_second);
}
 
开发者ID:IMSmobile,项目名称:Fahrplan,代码行数:26,代码来源:SettingActivity.java

示例2: onMenuItemClick

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public boolean onMenuItemClick(MenuItem item)
{
    TextInputLayout searchLayout = (TextInputLayout) activity.findViewById(R.id.search_input_layout);
    AutoCompleteTextView searchText = (AutoCompleteTextView) activity.findViewById(R.id.search_input_text);
    ImageButton cancel = (ImageButton) activity.findViewById(R.id.cancel_search);
    searchLayout.setVisibility(View.VISIBLE);
    cancel.setVisibility(View.VISIBLE);
    if ( searchText.requestFocus() )
    {
        showKeyboard();
    }
    AutoCompleteTextView searchAutoCompleteTextView = (AutoCompleteTextView) activity.findViewById(R.id.search_input_text);
    searchAutoCompleteTextView.setText(StringUtils.EMPTY);
    return true;
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:17,代码来源:ShowSearchFieldOnClickListener.java

示例3: fillToWithTakeMeHome

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private void fillToWithTakeMeHome() {
    String home = setting.getSettings(R.string.setting_key_take_me_home, "");
    if(home.isEmpty()) {
        Toast.makeText(this, this.getResources().getText(R.string.error_missing_take_me_home), Toast.LENGTH_LONG).show();
    } else {
        AutoCompleteTextView toText = (AutoCompleteTextView) findViewById(R.id.input_to);
        toText.setText(home, false);
    }
}
 
开发者ID:IMSmobile,项目名称:Fahrplan,代码行数:10,代码来源:MainActivity.java

示例4: startChangeDirection

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private void startChangeDirection() {
    AutoCompleteTextView fromText = (AutoCompleteTextView) findViewById(R.id.input_from);
    String bufferFrom = fromText.getText().toString();

    AutoCompleteTextView toText = (AutoCompleteTextView) findViewById(R.id.input_to);
    String bufferTo = toText.getText().toString();

    fromText.setText(bufferTo, false);
    toText.setText(bufferFrom, false);
}
 
开发者ID:IMSmobile,项目名称:Fahrplan,代码行数:11,代码来源:MainActivity.java

示例5: activateFavorite

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void activateFavorite(int position) {
    FavoriteModelItem fav = favorite.get(position);
    AutoCompleteTextView fromText = (AutoCompleteTextView) findViewById(R.id.input_from);
    AutoCompleteTextView toText = (AutoCompleteTextView) findViewById(R.id.input_to);
    fromText.setText(fav.getFrom(), false);
    toText.setText(fav.getTo(), false);
}
 
开发者ID:IMSmobile,项目名称:Fahrplan,代码行数:8,代码来源:MainActivity.java

示例6: setText

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private static void setText(AutoCompleteTextView view, CharSequence text, boolean filter) {
    try {
        Method method = AutoCompleteTextView.class.getMethod("setText", CharSequence.class, boolean.class);
        method.setAccessible(true);
        method.invoke(view, text, filter);
    } catch (Exception e) {
        //Fallback to public API which hopefully does mostly the same thing
        view.setText(text);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:11,代码来源:SearchView.java

示例7: initializeUi

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private void initializeUi() {
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    // Get the Layoutelements
    mBtnConnect = (Button) findViewById(R.id.btnConnect);
    mBtnConnect.setOnClickListener(oclConnect);
    mBtnConnect.requestFocus();

    mBtnMiamPlayer = (ImageButton) findViewById(R.id.btnMiamPlayerIcon);
    mBtnMiamPlayer.setOnClickListener(oclMiamPlayer);

    // Setup the animation for the MiamPlayer icon
    mAlphaDown = new AlphaAnimation(1.0f, 0.3f);
    mAlphaUp = new AlphaAnimation(0.3f, 1.0f);
    mAlphaDown.setDuration(ANIMATION_DURATION);
    mAlphaUp.setDuration(ANIMATION_DURATION);
    mAlphaDown.setFillAfter(true);
    mAlphaUp.setFillAfter(true);
    mAlphaUp.setAnimationListener(mAnimationListener);
    mAlphaDown.setAnimationListener(mAnimationListener);
    mAnimationCancel = false;

    // Ip and Autoconnect
    mEtIp = (AutoCompleteTextView) findViewById(R.id.etIp);
    mEtIp.setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    mEtIp.setThreshold(3);

    // Get old ip and auto-connect from shared preferences
    mEtIp.setText(mSharedPref.getString(SharedPreferencesKeys.SP_KEY_IP, ""));
    mEtIp.setSelection(mEtIp.length());

    ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
            android.R.layout.select_dialog_item, mKnownIps.toArray(new String[0]));
    mEtIp.setAdapter(adapter);

    // Get the last auth code
    mAuthCode = mSharedPref.getInt(SharedPreferencesKeys.SP_LAST_AUTH_CODE, 0);
}
 
开发者ID:MBach,项目名称:Miam-Player-remote,代码行数:39,代码来源:ConnectActivity.java

示例8: showEditBookmarkDialog

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private void showEditBookmarkDialog(final Context context, final HistoryItem item) {
    final AlertDialog.Builder editBookmarkDialog = new AlertDialog.Builder(context);
    editBookmarkDialog.setTitle(R.string.title_edit_bookmark);
    final View dialogLayout = View.inflate(context, R.layout.dialog_edit_bookmark, null);
    final EditText getTitle = (EditText) dialogLayout.findViewById(R.id.bookmark_title);
    getTitle.setText(item.getTitle());
    final EditText getUrl = (EditText) dialogLayout.findViewById(R.id.bookmark_url);
    getUrl.setText(item.getUrl());
    final AutoCompleteTextView getFolder =
            (AutoCompleteTextView) dialogLayout.findViewById(R.id.bookmark_folder);
    getFolder.setHint(R.string.folder);
    getFolder.setText(item.getFolder());
    final List<String> folders = bookmarkManager.getFolderTitles();
    final ArrayAdapter<String> suggestionsAdapter = new ArrayAdapter<>(context,
            android.R.layout.simple_dropdown_item_1line, folders);
    getFolder.setThreshold(1);
    getFolder.setAdapter(suggestionsAdapter);
    editBookmarkDialog.setView(dialogLayout);
    editBookmarkDialog.setPositiveButton(context.getString(R.string.action_ok),
            new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    HistoryItem editedItem = new HistoryItem();
                    editedItem.setTitle(getTitle.getText().toString());
                    editedItem.setUrl(getUrl.getText().toString());
                    editedItem.setUrl(getUrl.getText().toString());
                    editedItem.setFolder(getFolder.getText().toString());
                    bookmarkManager.editBookmark(item, editedItem);
                    eventBus.post(new BookmarkEvents.BookmarkChanged(item, editedItem));
                }
            });
    editBookmarkDialog.show();
}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:35,代码来源:BookmarksDialogBuilder.java

示例9: onCreateView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_create_admission, container, false);
    HomeActivity.navItemIndex = 6;
    communicator = new Communicator();
    /* Create Validator object to
     * call the setValidationListener method of Validator class*/
    validator = new Validator(this);
    // Call the validation listener method.
    validator.setValidationListener(this);
    // Instantiate Progress Dialog object
    prgDialog = new ProgressDialog(CreateAdmissionFragment.this.getActivity());
    // Set Progress Dialog Text
    prgDialog.setMessage("Please wait...");
    // Set Cancelable as False
    prgDialog.setCancelable(false);
    // Get a reference to the AutoCompleteTextView in the layout
    patientNames = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_patients);
    patientNames.setText(id);
    admissionDate = (EditText) view.findViewById(R.id.admissionDate);
    dischargeDate = (EditText) view.findViewById(R.id. dischargeDate);
    healthCentre = (EditText) view.findViewById(R.id.healthCentreET);
    notes = (EditText) view.findViewById(R.id.notesET);
    submit = (Button) view.findViewById(R.id.admission_submit);
    initialiseDialogs();
    patientsGet();
    addListenerOnButton();
    return view;
}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:31,代码来源:CreateAdmissionFragment.java

示例10: onCreateView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    HomeActivity.navItemIndex = 4;
    View view = inflater.inflate(R.layout.fragment_update_counselling, container, false);
    communicator = new Communicator();
    // Instantiate Progress Dialog object
    prgDialog = new ProgressDialog(UpdateCounsellingFragment.this.getActivity());
    // Set Progress Dialog Text
    prgDialog.setMessage("Please wait...");
    // Set Cancelable as False
    prgDialog.setCancelable(false);
    // Get a reference to the AutoCompleteTextView in the layout
    patientNames = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_patients);
    sessionType = (Spinner) view.findViewById(R.id.session_spinner);
    notesET = (EditText) view.findViewById(R.id.notesET);
    //sessionType = (Spinner) view.findViewById(R.id.session_spinner);
    submit = (Button) view.findViewById(R.id.session_submit);
    /* Create Validator object to
     * call the setValidationListener method of Validator class*/
    validator = new Validator(this);
    // Call the validation listener method.
    validator.setValidationListener(this);
    patientNames.setText(counsellingInfo[2]);
    notesET.setText(counsellingInfo[1]);
    patientsGet();
    addItemsOnSessionSpinner();
    submitListener();
    return view;
}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:32,代码来源:UpdateCounsellingFragment.java

示例11: onCreateView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    HomeActivity.navItemIndex = 4;
    View view = inflater.inflate(R.layout.fragment_create_counselling, container, false);
    communicator = new Communicator();
    // Instantiate Progress Dialog object
    prgDialog = new ProgressDialog(CreateCounsellingFragment.this.getActivity());
    // Set Progress Dialog Text
    prgDialog.setMessage("Please wait...");
    // Set Cancelable as False
    prgDialog.setCancelable(false);
    /* Create Validator object to
     * call the setValidationListener method of Validator class*/
    validator = new Validator(this);
    // Call the validation listener method.
    validator.setValidationListener(this);
    // Get a reference to the AutoCompleteTextView in the layout
    patientNames = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_patients);
    patientNames.setText(id);
    sessionType = (Spinner) view.findViewById(R.id.session_spinner);
    notesET = (EditText) view.findViewById(R.id.notesET);
    //sessionType = (Spinner) view.findViewById(R.id.session_spinner);
    submit = (Button) view.findViewById(R.id.session_submit);
    patientsGet();
    addItemsOnSessionSpinner();
    submitListener();
    return view;
}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:30,代码来源:CreateCounsellingFragment.java

示例12: onCreateView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    HomeActivity.navItemIndex = 3;
    View view = inflater.inflate(R.layout.fragment_create_appointment, container, false);
    communicator = new Communicator();
    /* Create Validator object to
     * call the setValidationListener method of Validator class*/
    validator = new Validator(this);
    // Call the validation listener method.
    validator.setValidationListener(this);
    // Instantiate Progress Dialog object
    prgDialog = new ProgressDialog(CreateAppointmentFragment.this.getActivity());
    // Set Progress Dialog Text
    prgDialog.setMessage("Please wait...");
    // Set Cancelable as False
    prgDialog.setCancelable(false);
    // Get a reference to the AutoCompleteTextView in the layout
    patientNames = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_patients);
    patientNames.setText(id);
    users = (Spinner) view.findViewById(R.id.ownerSpinner);

    //patientNames = (AutoCompleteTextView) findViewById(R.id.autocomplete_patients);
    //sessionType = (Spinner) findViewById(R.id.session_spinner);
    appointmentTypeET = (EditText) view.findViewById(R.id.appointmentTypeET);
    dateET = (EditText) view.findViewById(R.id.app_date_ET);
    startTimeET = (EditText) view.findViewById(R.id.startTimeET);
    endTimeET = (EditText) view.findViewById(R.id.endTimeET);
    notesET = (EditText) view.findViewById(R.id.noteET);
    //appDatePicker = (DatePicker) view.findViewById(R.id.app_datePicker);
    submit = (Button) view.findViewById(R.id.appointment_submit);
    patientsGet();
    addItemsOnUserSpinner();
    initialiseDialogs();
    addListenerOnButton();
    return view;
}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:39,代码来源:CreateAppointmentFragment.java

示例13: onCreateView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    HomeActivity.navItemIndex = 9;
    View view = inflater.inflate(R.layout.fragment_create_adverse_event, container, false);
    communicator = new Communicator();
    /* Create Validator object to
     * call the setValidationListener method of Validator class*/
    validator = new Validator(this);
    // Call the validation listener method.
    validator.setValidationListener(this);
    // Instantiate Progress Dialog object
    prgDialog = new ProgressDialog(CreateAdverseEventFragment.this.getActivity());
    // Set Progress Dialog Text
    prgDialog.setMessage("Please wait...");
    // Set Cancelable as False
    prgDialog.setCancelable(false);
    // Get a reference to the AutoCompleteTextView in the layout
    patientNames = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_patients);
    patientNames.setText(id);
    eventDate = (EditText) view.findViewById(R.id.eventDateET);
    adverseEvent = (Spinner) view.findViewById(R.id.AdverseEventspinner);
    notes = (EditText) view.findViewById(R.id.noteET);
    submit = (Button) view.findViewById(R.id.adverse_submit);
    initialiseDialog();
    patientsGet();
    addItemsOnSpinner();
    addListenerOnButton();
    return view;
}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:31,代码来源:CreateAdverseEventFragment.java

示例14: onCreateView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    HomeActivity.navItemIndex = 8;
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_update_medical_rec, container, false);
    communicator = new Communicator();
    /* Create Validator object to
     * call the setValidationListener method of Validator class*/
    validator = new Validator(this);
    // Call the validation listener method.
    validator.setValidationListener(this);
    // Instantiate Progress Dialog object
    prgDialog = new ProgressDialog(UpdateMedicalRecFragment.this.getActivity());
    // Set Progress Dialog Text
    prgDialog.setMessage("Please wait...");
    // Set Cancelable as False
    prgDialog.setCancelable(false);
    // Get a reference to the AutoCompleteTextView in the layout
    patientNames = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_patients);
    recordType = (Spinner) view.findViewById(R.id.reportTypeSpinner);
    recordTypeGet();
    title = (EditText) view.findViewById(R.id.titltET);
    notesET = (EditText) view.findViewById(R.id.notesET);
    submit = (Button) view.findViewById(R.id.appointment_submit);
    patientsGet();
    addListenerOnButton();
    title.setText(input[0], TextView.BufferType.EDITABLE);
    patientNames.setText(input[2], TextView.BufferType.EDITABLE);
    notesET.setText(input[3], TextView.BufferType.EDITABLE);
    return view;
}
 
开发者ID:thandile,项目名称:msf_communique,代码行数:33,代码来源:UpdateMedicalRecFragment.java

示例15: getView

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@NonNull
@Override
public View getView(final int position, View convertView, @NonNull ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) getContext().
                getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(LAYOUT_RES, parent, false);
    }

    String phone = phones.get(position);

    final AutoCompleteTextView phoneEditText = (AutoCompleteTextView)
            convertView.findViewById(R.id.edittext_phonenumber);
    ImageButton deleteButton = (ImageButton) convertView.findViewById(R.id.imageButton_delete);

    phoneEditText.setText(phone);
    if (phoneListAdapter != null)
        phoneEditText.setAdapter(phoneListAdapter);

    deleteButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            removePhone(position);
        }
    });

    return convertView;
}
 
开发者ID:tranquvis,项目名称:SimpleSmsRemote,代码行数:29,代码来源:GrantedPhonesEditableListAdapter.java


注:本文中的android.widget.AutoCompleteTextView.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。