写一个dialog
new AlertDialog.Builder(MainActivity.this).setTitle("有更新").setMessage("最新版本4.2.2")
.setPositiveButton("更新", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(MainActivity.this, UpdateService.class);
intent.putExtra("apkUrl", "http://");
startService(intent);
}
}).setNegativeButton("取消", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).show();