TextView setKeyListener - 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 setKeyListener method.

This code example shows how to use the following methods:getTag, setTag, getKeyListener, setKeyListener
        result.setLongitude(longitude);
        return result;
    } 
 
    public static void setEditTextReadOnly(EditText editText, boolean readOnly) {
        Object tag = editText.getTag(RANDOM_TAG_KEY);
        boolean wasReadOnly = tag != null;
        if (readOnly == wasReadOnly) {
            return; 
        } 
        if (readOnly) {
            editText.setTag(RANDOM_TAG_KEY, editText.getKeyListener());
            editText.setKeyListener(null);
        } else { 
            editText.setKeyListener((KeyListener) tag);
        } 
    } 
 
    public static void logv(String className, String methodName, String fmt, Object... args) {
        if (DEBUG) {
6
CodeRank
This code example shows how to use the following methods:setKeyListener, setSingleLine, setTransformationMethod
        super.onBindDialogView(view);
         
        final EditText editText = (EditText) view.findViewById(android.R.id.edit);
         
        if (editText != null) {
            editText.setSingleLine(true);
            editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
            editText.setKeyListener(DigitsKeyListener.getInstance());
        } 
    } 
 
    public boolean isDialogOpen() { 
        return mDialogOpen;
    } 
     
    @Override 
    protected void onDialogClosed(boolean positiveResult) {
        super.onDialogClosed(positiveResult);
        mDialogOpen = false;
        if (mPinListener != null) {
6
CodeRank
This code example shows how to use the following methods:setKeyListener
    public MACPreference(Context context, AttributeSet attrs) { super(context, attrs); }
    public MACPreference(Context context) { super(context); }
 
    @Override 
    protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
        editText.setKeyListener(DigitsKeyListener.getInstance("0123456789ABCDEFabcdef:-."));
        super.onAddEditTextToDialogView(dialogView, editText);
    } 
 
    public static boolean validate(String addr) {
        return Util.MACAddress.parse(addr) != null;
    } 
     
    @Override 
    protected void onDialogClosed(boolean positiveResult) {
        if (positiveResult) {
            // verify now that it's an IP 
            String addr = getEditText().getText().toString();
            if (addr.length() != 0 && !validate(addr)) { // note empty address is fine
                Toast.makeText(getContext(), 
5
CodeRank
This code example shows how to use the following methods:setKeyListener
    public IPPreference(Context context, AttributeSet attrs) { super(context, attrs); }
    public IPPreference(Context context) { super(context); }
 
    @Override 
    protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
        editText.setKeyListener(DigitsKeyListener.getInstance("0123456789."));
        super.onAddEditTextToDialogView(dialogView, editText);
    } 
 
    public static boolean validate(String addr) {
        try { 
            //if(addr.length() == 0) // don't want empty address 
            //	return false; 
            if(java.net.InetAddress.getByName(addr) == null)
                return false; 
        } catch (java.net.UnknownHostException e) {
            return false; 
        } 
        return true; 
    } 
5
CodeRank
This code example shows how to use the following methods:setKeyListener
	public MeshIPPreference(Context context, AttributeSet attrs) { super(context, attrs); }
	public MeshIPPreference(Context context) { super(context); }
 
	@Override 
	protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
		editText.setKeyListener(DigitsKeyListener.getInstance("0123456789."));
		super.onAddEditTextToDialogView(dialogView, editText);
	} 
 
	public static boolean validate(String addr) {
		if (addr.matches("^[0-9]{1,3}$"))
		{ 
			int prefix = Integer.valueOf(addr).intValue();
			if (prefix > 0 && prefix < 255)
				return true; 
			else 
				return false; 
		} 
		try { 
			//if(addr.length() == 0) // don't want empty address 
4
CodeRank
This code example shows how to use the following methods:setKeyListener
	public IPPreference(Context context, AttributeSet attrs) { super(context, attrs); }
	public IPPreference(Context context) { super(context); }
 
	@Override 
	protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
		editText.setKeyListener(DigitsKeyListener.getInstance("0123456789."));
		super.onAddEditTextToDialogView(dialogView, editText);
	} 
 
	public static boolean validate(String addr) {
		try { 
			//if(addr.length() == 0) // don't want empty address 
			//	return false; 
			if(java.net.InetAddress.getByName(addr) == null)
				return false; 
		} catch (java.net.UnknownHostException e) {
			return false; 
		} 
		return true; 
	} 
4
CodeRank
This code example shows how to use the following methods:setKeyListener
	public MACPreference(Context context, AttributeSet attrs) { super(context, attrs); }
	public MACPreference(Context context) { super(context); }
 
	@Override 
	protected void onAddEditTextToDialogView(View dialogView, EditText editText) {
		editText.setKeyListener(DigitsKeyListener.getInstance("0123456789ABCDEFabcdef:-."));
		super.onAddEditTextToDialogView(dialogView, editText);
	} 
 
	public static boolean validate(String addr) {
		return Util.MACAddress.parse(addr) != null;
	} 
 
	@Override 
	protected void onDialogClosed(boolean positiveResult) {
		if (positiveResult) {
			// verify now that it's an IP 
			String addr = getEditText().getText().toString();
			if (addr.length() != 0 && !validate(addr)) { // note empty address is fine
				Toast.makeText(getContext(), 
4
CodeRank

Related TextView setKeyListener Questions & Answers:

setKeyListener Method Overview
Sets the key listener to be used with this TextView.
See Code Examples for other Android TextView Methods: