adsense

2011-03-24

[android] AltertDialog 連結

private void openOptionsDialog() {
// TODO Auto-generated method stub
new AlertDialog.Builder(Bmi.this)
.setNegativeButton(R.string.home_page,
new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int i) {
// TODO Auto-generated method stub
Uri uri =Uri.parse("https://www.google.com/");
Intent intent =new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
})



也可以換成
Uri uri =Uri.parse("geo:25.047172, 121.518981");

Intent intent =new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);

or
Uri uri =Uri.parse("tel:123456789");

Intent intent =new Intent(Intent.ACTION_DIAL,uri);
startActivity(intent);

沒有留言:

張貼留言