about uscontact

입력 문자 수 제한하기

Author: zemna
Date: April 17, 2021
Share this:

입력할 수 있는 문자의 수를 제한하는 방법.

- setFilters(InputFilter[] filters) 함수를 사용한다. - InputFilter.LengthFilter(int max) 함수를 사용하여 원하는 자리수를 지정한다.

[code lang="java"] public class TextChange extends Activity {

EditText mEdit;

/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

// Find edit box mEdit = (EditText)findViewById(R.id.edit);

// Apply Filters mEdit.setFilters(new InputFilter[] { new InputFilter.LengthFilter(3) }); } } [/code]

Share this:

Leave a Reply

Your email address will not be published.


Professional software development agency estalished in Indonesia. We offers website setup, web application development, fulfillment service, and etc.
Follow us
Follow us to get latest news and tutorials.
2022 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️