0

我必须设置操作以在单击警报对话框文本时启动活动我该怎么做请帮忙。 在此处输入图像描述

我的代码在这里

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();
4

0 回答 0