How to display HTML in TextView?

You need to use Html.fromHtml() to use HTML in your XML Strings. Simply referencing a String with HTML in your layout XML will not work. This is what you should do in Java if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { textView.setText(Html.fromHtml(“<h2>Title</h2><br><p>Description here</p>”, Html.FROM_HTML_MODE_COMPACT)); } else { textView.setText(Html.fromHtml(“<h2>Title</h2><br><p>Description here</p>”)); } And in Kotlin: textView.text = if (Build.VERSION.SDK_INT >= … Read more

Is it possible to have multiple styles inside a TextView?

In case, anyone is wondering how to do this, here’s one way: (Thanks to Mark again!) mBox = new TextView(context); mBox.setText(Html.fromHtml(“<b>” + title + “</b>” + “<br />” + “<small>” + description + “</small>” + “<br />” + “<small>” + DateAdded + “</small>”)); For an unofficial list of tags supported by this method, refer to … Read more

Create Passcode view in Android

To capture the backspace,its actually the delete key in android. you can capture it via editText.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_DEL){ //delete key pressed } return false; } }); To hide the keyboard try this InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);