new AlertDialog.Builder(bmi.this).setTitle(R.string.about_title).setMessage(R.string.about_msg).setPositiveButton("确认", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface,int i){}
}).setNegativeButton(R.string.homepage_label, new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface,int i)
{
//try{
Uri uri=Uri.parse(getString(R.string.homepage_uri));
Intent intent=new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
//}
/*catch(URISyntaxException e)
{
}*/
}
}).show();
会自动消失的对话框
import android.widget.Toast;
Toast.makeText(bmi.this, "BMI计算器", Toast.LENGTH_SHORT).show();