我想在下面显示警报对话框,但它强制关闭,我对上下文应该是什么感到有些困惑。单击图像时将显示此对话框。
AlertDialog.Builder builder = new AlertDialog.Builder(
getApplicationContext(), R.style.TitleDialog);
builder.setTitle("Sorry for Inconvinience");
builder.setMessage("You need to install MX Player or VLC Media Player");
AlertDialog alert = builder.create();
alert.show();
我是一个初学者,对您的任何帮助将不胜感激。
ib2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (isInternetPresent) {
try {
startActivity(i2);
} catch (Exception e) {
AlertDialog.Builder builder = new AlertDialog.Builder(Main.this);
builder.setTitle("Sorry for Inconvinience");
builder.setMessage("You need to install MX Player or VLC Media Player, here is the link: ");
AlertDialog alert = builder.create();
alert.show();
}
} else {
Toast.makeText(getApplicationContext(),
"Please check your Internet Connection.",
Toast.LENGTH_LONG).show();
}
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(Activity.this);
builder.setTitle("Sorry for Inconvinience");
buildersetMessage("You need to install MX Player or VLC Media Player");
.show();
上面的代码应该可以工作。我也不知道
getApplicationContext(), R.style.TitleDialog);
用于。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句