TextView setHint - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView setHint method.

This code example shows how to use the following methods:requestFocus, setOnFocusChangeListener, setHint, setInputType, setText
            mHint = object.optString("hint");
            mAutofocus = object.optBoolean("autofocus");
        } 
 
        public View getView(final Context context) throws UnsupportedOperationException {
            EditText input = new EditText(context);
            input.setInputType(InputType.TYPE_CLASS_TEXT);
            input.setText(mValue);
 
            if (!TextUtils.isEmpty(mHint)) {
                input.setHint(mHint);
            } 
 
            if (mAutofocus) {
                input.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                    @Override 
                    public void onFocusChange(View v, boolean hasFocus) {
                        if (hasFocus) {
                            ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(v, 0);
                        } 

8
CodeRank
This code example shows how to use the following methods:setHint, setInputType
			setTitle(DIALOG_TITLE);
			setCancelable(true);
			setNegativeButton("Entered Page", this);
			setNeutralButton("First Page", this);
			setPositiveButton("Last Page", this);
			pageField = new EditText(context);
			pageField.setInputType(InputType.TYPE_CLASS_NUMBER);
			pageField.setHint(PAGE_FIELD_HINT);
			setView(pageField);
		} else { 
			Toast.makeText(getContext(), "No pages", Toast.LENGTH_SHORT).show();
		} 
	} 
 
	@Override 
	public void onClick(DialogInterface dialog, int which) {
		if (which == AlertDialog.BUTTON_NEGATIVE) {
			try { 
				int input = Integer.valueOf(pageField.getText().toString());
				if (input > 0 && input <= maxPage) {
6
CodeRank
This code example shows how to use the following methods:setGravity, setHint
		dialogMessage.setText(messageRes);
		LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
		params.setMargins(0, 0, 0, 15);
		addView(dialogMessage,params);
 
		dialogResult = new EditText(context);
		dialogResult.setGravity(Gravity.TOP);
		dialogResult.setHint(hintRes);
		addView(dialogResult,new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
		 
	} 
	 
	public EditText getEditText(){
		return dialogResult;
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:setHint
	public void dismiss(){ 
		this.mDialog.dismiss();
	} 
	 
	private View createView(){
        this.mEditTextView = new EditText(this.mContext);
        this.mEditTextView.setHint(this.mHint);
         
        FrameLayout rootLayout = new FrameLayout(this.mContext);
        rootLayout.setPadding(10, 0, 10, 0);
        rootLayout.addView(this.mEditTextView);
         
        return rootLayout;
	} 
} 
6
CodeRank
This code example shows how to use the following methods:setOnKeyListener, setHint
This code example shows how to use the following methods:setHint
	@Override 
	public void setFieldDescription(FieldDescriptor descriptor, LayoutOptions layoutOptions)
	{ 
		super.setFieldDescription(descriptor, layoutOptions);
		mAdapter = (FieldAdapter<?>) descriptor.getFieldAdapter();
		mText.setHint(descriptor.getHint());
	} 
 
 
	@Override 
	public void onContentChanged(ContentSet contentSet)
	{ 
		Object value;
		if (mValues != null && (value = mAdapter.get(mValues)) != null)
		{ 
			String urlString = value.toString();
			mText.setText(Html.fromHtml("<a href='" + urlString + "'>" + urlString + "</a>"));
			setVisibility(View.VISIBLE);
		} 
		else 
5
CodeRank
This code example shows how to use the following methods:requestFocus, setFocusable, setFocusableInTouchMode, setId, setLayoutParams
This code example shows how to use the following methods:setBackgroundDrawable, setId, setLayoutParams, setHint, setHintTextColor
4
CodeRank
This code example shows how to use the following methods:setHint
This code example shows how to use the following methods:setHint
		_input.setText( value );
	} 
	 
	@Override  
	public void setHint( String value ){
		_input.setHint( value );
	} 
} 
4
CodeRank

Related TextView setHint Questions & Answers:

setHint Method Overview
Sets the text to be displayed when the text of the TextView is empty.
See Code Examples for other Android TextView Methods: