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

This code example shows how to use the following methods:setLayoutParams, getText, length, setText, setTextColor
        lp.topMargin = 10;
        iv.setLayoutParams(lp);
         
         
        // Add label: 
        TextView tv = new TextView(this);
        lp = new LinearLayout.LayoutParams(
        		85, 
        		35); 
        lp.bottomMargin = 6;
        tv.setLayoutParams(lp);
         
        tv.setText(info.activityInfo.loadLabel(getPackageManager()));
        tv.setTextColor(Color.BLACK);
        tv.setTextSize(15);
         
        // First convert text to 'spannable' 
		tv.setText(tv.getText(), TextView.BufferType.SPANNABLE);
		Spannable str = (Spannable) tv.getText();
		 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:length
        showSecurityFields(); 
        validate(); 
    } 
 
    private void validate() { 
        if ((mSsid != null && mSsid.length() == 0) ||
                   (((mSecurityTypeIndex == WPA_INDEX) || (mSecurityTypeIndex == WPA2_INDEX))&&
                        mPassword.length() < 8)) {
            getButton(BUTTON_SUBMIT).setEnabled(false);
        } else { 
            getButton(BUTTON_SUBMIT).setEnabled(true);
        } 
    } 
 
    public void onClick(View view) {
        mPassword.setInputType(
                InputType.TYPE_CLASS_TEXT | (((CheckBox) view).isChecked() ?
                InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
                InputType.TYPE_TEXT_VARIATION_PASSWORD));
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:length
    @Override 
    public void onResume() { 
        super.onResume(); 
        mDialog.getWindow()
                .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        if (mQuickResponseEditText.length() == 0) {
            mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
        } 
    } 
 
    // implements TextWatcher 
    @Override 
    public void afterTextChanged(Editable s) {
            mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(s.length() > 0);
    } 
 
    // implements TextWatcher 
    @Override 
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getText, length
 
		setActionBarTitle("Compose..."); 
	} 
 
	public void send(View v) {
		if (body.length() > 0) {
			new Send().execute(subject.getText().toString(), body.getText().toString());
			finish(); 
		} else { 
			Toast.makeText(this, "Nothing entered", Toast.LENGTH_SHORT).show();
		} 
	} 
 
	@Override 
	protected void onPause() { 
		overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
		super.onPause(); 
	} 
 
	private class Send extends AsyncTask<String, Void, Boolean> {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSelectionStart, length
        mLineLength = nDigits;
    } 
 
    boolean eatHorizontalMove(boolean toLeft) {
        EditText editText = mDisplay.getEditText();
        int cursorPos = editText.getSelectionStart();
        return toLeft ? cursorPos == 0 : cursorPos >= editText.length();
    } 
 
    private String getText() {
        return mDisplay.getText().toString();
    } 
 
    void insert(String delta) {
        mDisplay.insert(delta);
        setDeleteMode(DELETE_MODE_BACKSPACE);
    } 
 
    public void onTextChanged() { 
        setDeleteMode(DELETE_MODE_BACKSPACE);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getText, length
        } 
        super.finish(); 
    } 
 
    public void afterTextChanged(Editable s) {
        if (this.password.length() < this.minPasswordLength) {
            Log.d(TAG, "Password too short");
        } else if (this.password.length() != this.passwordVerification.length()) {
            Log.d(TAG, "Passwords' length differs");
        } else if (!this.password.getText().toString().equals(
                this.passwordVerification.getText().toString())) {
            Log.d(TAG, "Passwords differ");
        } else { 
            Log.d(TAG, "Passwords are the same");
            this.ok.setEnabled(true);
            return; 
        } 
        this.ok.setEnabled(false);
    } 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSelectionStart, length
        mLineLength = nDigits;
    } 
 
    boolean eatHorizontalMove(boolean toLeft) {
        EditText editText = mDisplay.getEditText();
        int cursorPos = editText.getSelectionStart();
        return toLeft ? cursorPos == 0 : cursorPos >= editText.length(); 
    } 
 
    private String getText() {
        return mDisplay.getText().toString();
    } 
 
    void insert(String delta) {
        mDisplay.insert(delta);
    } 
 
    private void setText(CharSequence text) {
        mDisplay.setText(text, CalculatorDisplay.Scroll.UP);
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getText, length
		resultView.setOnFocusChangeListener(this);
	} 
 
	public boolean isComplete() { 
		// compare result with resultView.getText() 
		if (String.valueOf(result).equals(String.valueOf((resultView.getText())))) {
			return true; 
		} else { 
			return false; 
		} 
	} 
 
	public void setStateToNormal() { 
		state = STATE_NORMAL;
		bgView.setBackgroundResource(R.drawable.numbercrunch_bgquiz);
		resultView.setFocusable(true);
		resultView.setFocusableInTouchMode(true);
	} 
 
	public void setStateToCorrect() { 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:length
     */ 
    public void testPreconditions() { 
        assertNotNull(mToView);
        assertEquals(0, mToView.length());
        assertNotNull(mSubjectView);
        assertEquals(0, mSubjectView.length());
        assertNotNull(mMessageContentView);
    } 
     
    /** 
     * Test that we have the necessary permissions to write to external storage. 
     */ 
    public void testAttachmentWritePermissions() throws FileNotFoundException, IOException { 
        File file = null;
        try { 
            // If there's no storage available, this test is moot 
            if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                return; 
            } 
            file = MessageView.createUniqueFile(Environment.getExternalStorageDirectory(),
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:length
    @Override 
    public void onResume() { 
        super.onResume(); 
        mDialog.getWindow()
                .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        if (mQuickResponseEditText.length() == 0) {
            mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
        } 
    } 
 
    // implements TextWatcher 
    @Override 
    public void afterTextChanged(Editable s) {
            mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(s.length() > 0);
    } 
 
    // implements TextWatcher 
    @Override 
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related TextView length Questions & Answers:

length Method Overview
Returns the length, in characters, of the text managed by this TextView
See Code Examples for other Android TextView Methods: