我有这段代码可以使用文本视图创建一个带有可点击链接的警报对话框:
public static class MyOtherAlertDialog {
public static AlertDialog create(Context context) {
final TextView message = new TextView(context);
// i.e.: R.string.dialog_message =>
// "Test this dialog following the link to dtmilano.blogspot.com"
final SpannableString s =
new SpannableString(context.getText(R.string.dialog_about));
Linkify.addLinks(s, Linkify.WEB_URLS);
message.setText(s);
message.setMovementMethod(LinkMovementMethod.getInstance());
return new AlertDialog.Builder(context)
.setTitle(R.string.about)
.setCancelable(true)
.setIcon(android.R.drawable.ic_dialog_info)
.setPositiveButton("ok", null)
.setView(message)
.create();
}
}
但是不知道具体怎么称呼
我试过了:
MyOtherAlertDialog variable = new MyOtherAlertDialog();
variable.create(this);
但是没有运气,我应该如何称呼这个类?