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


Java BootstrapEditText.setText方法代码示例

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


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

示例1: showEditTextDialog

import com.beardedhen.androidbootstrap.BootstrapEditText; //导入方法依赖的package包/类
public static void showEditTextDialog(Context mContext, String title, String initialText, final IFuncPtr functionToBeRun) {

		LayoutInflater inflater = (LayoutInflater)mContext.getSystemService (Context.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(R.layout.dialog_with_text, null);

		// custom dialog
		final Dialog dialog = new AlertDialog.Builder(mContext)
				.setTitle(title)
				.setView(v)
				.create();

		BootstrapButton okButton = (BootstrapButton) v.findViewById(R.id.okbutton);
		final BootstrapEditText insertedText = (BootstrapEditText) v.findViewById(R.id.addedText);
		insertedText.setText(initialText);
		okButton.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
				functionToBeRun.execute(insertedText.getText().toString());
				dialog.dismiss();
			}
		});

		dialog.show();
	}
 
开发者ID:adityak368,项目名称:Android-FileBrowser-FilePicker,代码行数:25,代码来源:UIUtils.java

示例2: onCreateView

import com.beardedhen.androidbootstrap.BootstrapEditText; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
    act = getActivity();
    rootView = inflater.inflate(R.layout.fragment_login, container, false);
    setHasOptionsMenu(true);

    final BootstrapEditText email = (BootstrapEditText) rootView.findViewById(R.id.email);
    final BootstrapEditText password = (BootstrapEditText) rootView.findViewById(R.id.password);
    final BootstrapButton btnLogin = (BootstrapButton) rootView.findViewById(R.id.btnLogin);
    CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.showPass);

    InputFilter filter = new InputFilter() {
        public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
            for (int i = start; i < end; i++) {
                if (Character.isSpaceChar(source.charAt(i))) {
                    return "";
                }
            }
            return null;
        }
    };

    email.setFilters(new InputFilter[]{filter});
    password.setFilters(new InputFilter[]{filter});

    if(!act.getSharedPreferences("EroadPrefs", 0).getString("user_name", "").equals("")){
        email.setText(act.getSharedPreferences("EroadPrefs", 0).getString("user_email", ""));
    }

    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (!isChecked) {
                password.setTransformationMethod(PasswordTransformationMethod.getInstance());
            } else {
                password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
            }
        }
    });

    btnLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String string_email = email.getText().toString();
            String string_password = password.getText().toString();
            if (!string_password.trim().equals("")) {
                new CheckIfUserExists(string_email, encryptPassword(string_password)).execute();
            }else {
                Toast.makeText(act, "The password can not be empty", Toast.LENGTH_SHORT).show();
            }
        }
    });

    return rootView;
}
 
开发者ID:lioutasb,项目名称:eme_road,代码行数:56,代码来源:LoginFragment.java


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