span.Click() not working
Closed this issue · 3 comments
mike-maina commented
Spanner spanner = new Spanner()
.append("I accept terms & conditions")
.span("terms & conditions", Spans.click(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(ConfirmOtpActivity.this, TermsAndConditionActivity.class));
Log.e("testing", "testing");
}
}));
txt_terms_and_condition.setText(spanner);
my gradle
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 26}
am testing with android 6 device
neworld commented
Hello @mike-maina,
Did you setup movement method of that TextView
?
textView.setMovementMethod(new LinkMovementMethod());
mike-maina commented
unfortunately i had not done so (textView.setMovementMethod(new LinkMovementMethod());) even after spending a few hours trying to figure out what was going wrong.
Thank you for your time. It worked after adding that line of code.
neworld commented
Glad it worked for you. I will clarify documentation about this. Maybe, do you have an idea how it could be solved gracefully with lib API?