-1

Android maxLength: 500

EditText ed=(EditText)findViewById(R.id.edittext);

int maxLength= //current maxlength + 10 // im looking for the current max length code to add it with 10

ed.setFilters(new InputFilter[]{new 

InputFilter.LengthFilter(maxLength)});

The output will be a total of 510 maxLength character input in first click of button and on second click it will be 520 and so on and so fort.

Sukhi
  • 13,261
  • 7
  • 36
  • 53
  • 2
    Have you tried anything so far? – Yash Aug 23 '19 at 13:02
  • Possible duplicate of [Android: how to handle button click](https://stackoverflow.com/questions/14782901/android-how-to-handle-button-click) – Yash Aug 23 '19 at 13:05
  • @jaidran what have you tried for it..Here we are all here to help you, but the only condition is that you need to put your effort on it – Ravindra Kushwaha Aug 23 '19 at 13:06
  • EditText ed=(EditText)findViewById(R.id.edittext); int maxLength= //looking for current maxlength + 10 ed.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); – Jaidran De Guzman Alano Aug 23 '19 at 13:35

1 Answers1

1

Pretty straight forward

button.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        final int width = button.getLayoutParams().width + 10;
        final int height = button.getLayoutParams().height;
        button.setLayoutParams(new LayoutParams(width, height));
    }
 });

Since your first question wasn't very clear here is the update:

int maxLength = 500;

button.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        maxlength = maxLength + 10;
        editText.setFilters(new InputFilter[] {
            new InputFilter.LengthFilter(maxLength)
        });
    }
 });
JakeB
  • 2,043
  • 3
  • 12
  • 19
  • Android maxLength: 500 EditText ed=(EditText)findViewById(R.id.edittext); int maxLength= //current maxlength + 10 // im looking for the current max length code to add it with 10 ed.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)}); The output will be a total of 510 maxLength character input in first click of button and on second click it will be 520 and so on and so fort. – Jaidran De Guzman Alano Aug 23 '19 at 13:48