new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
try{
Uri uri=Uri.parse("http://www.baidu.com");
Intent intent=new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}catch(URISyntaxException e){
}
}
}URISyntaxException 这个异常类型,Eclipse里不给我用。
提示说 Unreachable catch block for URISyntaxException. This exception is never thrown from the try statement body
public void onClick(DialogInterface arg0, int arg1) {
try{
Uri uri=Uri.parse("http://www.baidu.com");
Intent intent=new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}catch(URISyntaxException e){
}
}
}URISyntaxException 这个异常类型,Eclipse里不给我用。
提示说 Unreachable catch block for URISyntaxException. This exception is never thrown from the try statement body
catch(Exception e){
}算了
Android开发入门指南的88页上,就是这么写的代码,我学着他照原样写的
而Uri是android.net.Uri