Widget - Line for Edittext

private boolean LineAble = false;

private double count = 0;
private double line = 0;

edittext1.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) {
final String _charSeq = _param1.toString();
textview1.setText("1");
if (LineAble) {
count = edittext1.getLineCount() - 1;
line = 1;
for(int _repeat32 = 0; _repeat32 < (int)(count); _repeat32++) {
_addLine();
}
}
}

@Override
public void beforeTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) {

}

@Override
public void afterTextChanged(Editable _param1) {

}
});

private void _addLine () {
textview1.setText(textview1.getText().toString().concat("
".concat(String.valueOf((long)(line + 1)))));
line++;
}

//Additional add with timer 400
android.view.inputmethod.BaseInputConnection inputConnection = new android.view.inputmethod.BaseInputConnection(edittext1, true); inputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SPACE));
//this will auto show line with new file opened!. like on SKManager editor.

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

Create a Stopwatch App using Chronometer in Sketchware

Create app to save all passwords, protected using voice key