调用系统程序打开指定的图片

来源:互联网 发布:卡盟主站源码 编辑:程序博客网 时间:2024/04/30 12:06

调用系统程序打开指定的图片

1

    File file = new File(advInfo.strFullImagePath);
    if( file != null && file.isFile() == true){
     Intent intent = new Intent();
     intent.setAction(android.content.Intent.ACTION_VIEW);
     intent.setDataAndType(Uri.fromFile(file), "image/*");
     SNAdvView.this.getContext().startActivity(intent);   }     
    }


2

  Intent intent = new Intent(Intent.ACTION_VIEW);  
   intent.setDataAndType(Uri.parse("file://"+chosenPicFile), "image/*");
   startActivity(intent);

ps:分别setData和setType会失败。


原创粉丝点击