---
title: "调用本机的播放器"
author: "AndLi"
date: "2012-02-12T21:17:59Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2012-02-12T21:17:59Z"
id: 1403369
url: "https://andli.iteye.com/blog/1403369"
---

// 调用系统播放器，播放录音  
private void playRec(File file) {  
Intent intent = new Intent();  
intent.addFlags(Intent.FLAG\_ACTIVITY\_NEW\_TASK);  
intent.setAction(android.content.Intent.ACTION\_VIEW);  
intent.setDataAndType(Uri.fromFile(file), "audio");/* 设置文件类型 \*/  
startActivity(intent);  
}

 

 

\-------------------------------------------