in fact I am trying to design application to write custom text , that text is like as "محمّدُ " , but I can not write char 'ُ ' by soft keyboard I tried way handle keyevent in edittext by this code:
[HIGH]
public boolean onKey(View view, int keyCode, KeyEvent event)
{ if (keyCode == KeyEvent.KEYCODE_B|| keyCode =KeyEvent.KEYCODE_5)
{ editText1.setText("ً");
return true; }
return false;
}}[/HIGH] but when I press on key 5 (or key enter) the text was work corrctly (it occurred "ً") and when I press on key B the text is not work and occurred char B in edit text
then I tried way textwacher that show bellow but occure same problem
[HIGH]editText1.addTextChangedListener(new TextWatcher()
{ public void afterTextChanged(Editable s)
{ editText1.setOnKeyListener(new OnKeyListener()
{ public boolean onKey(View v, int keyCode,KeyEvent event)
{ // If the event is a key-down event on the "enter" button
if (keyCode == KeyEvent.KEYCODE_M)
{ editText1.setText("م");
return true;
}
return false;
} }); }
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{ }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{ }
});
[/HIGH] please any one guide me on way to write custom text. thanks.
[HIGH]
public boolean onKey(View view, int keyCode, KeyEvent event)
{ if (keyCode == KeyEvent.KEYCODE_B|| keyCode =KeyEvent.KEYCODE_5)
{ editText1.setText("ً");
return true; }
return false;
}}[/HIGH] but when I press on key 5 (or key enter) the text was work corrctly (it occurred "ً") and when I press on key B the text is not work and occurred char B in edit text
then I tried way textwacher that show bellow but occure same problem
[HIGH]editText1.addTextChangedListener(new TextWatcher()
{ public void afterTextChanged(Editable s)
{ editText1.setOnKeyListener(new OnKeyListener()
{ public boolean onKey(View v, int keyCode,KeyEvent event)
{ // If the event is a key-down event on the "enter" button
if (keyCode == KeyEvent.KEYCODE_M)
{ editText1.setText("م");
return true;
}
return false;
} }); }
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{ }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{ }
});
[/HIGH] please any one guide me on way to write custom text. thanks.