0

I have to set action to start an activity on click of alert dialog text how can i do that please help. enter image description here

my code is here

SpannableStringBuilder builder = new SpannableStringBuilder();

String reminderMsg = "Please pay your bill now";
Spannable msg = new SpannableString(reminderMsg);
msg.setSpan(new ForegroundColorSpan(Color.BLACK), 0, reminderMsg.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.append(msg);

String click = " Click here";
Spannable wordtoSpan = new SpannableString(click);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 1, click.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.append(wordtoSpan);

new AlertDialog.Builder(MiActivity.this)
        .setMessage(builder)
        .setPositiveButton("OK", null)
        .show();
Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57

0 Answers0