SpannableString policySpan= new SpannableString("Check this link Privacy Policy"); policySpan.setSpan(new ClickableSpan() { @Override public void onClick(View textView) { startActivity(new Intent(CurrentActivity.this, NextActivity.class)); } @Override public void updateDrawState(TextPaint tpaint) { super.updateDrawState(tpaint); tpaint.setUnderlineText(true); } }, 16, policySpan.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); TextView textView = (TextView) findViewById(R.id.policy); textView.setText(policySpan); textView.setMovementMethod(LinkMovementMethod.getInstance()); textView.setHighlightColor(Color.TRANSPARENT);
Courtersy: http://stackoverflow.com/a/10697453
No comments:
Post a Comment