1、权限

2、代码

name=etmc.getText().toString();//获取歌曲自定义名称
byte[] bname=name.getBytes();

try
{
name=new String(bname,"utf-8");//中文转码
}
catch (UnsupportedEncodingException e1)
{
e1.printStackTrace();
}

new Thread()
{
public void run()
{
try
{
URL url=new URL(uri);//获取链接
HttpURLConnection conn = (HttpURLConnection) url.openConnection();//打开链接
conn.setConnectTimeout(6* 1000);//设置时间缓冲
if (conn.getResponseCode() != 200) throw new RuntimeException("请求url失败");//判断链接是否失败
InputStream is = conn.getInputStream();//获取InputStream流对象
readAsFile(is,new File("/sdcard/"+name+".mp3"));//将获取InputStream流对象数据存入指定文件夹

} catch (Exception e)
{
e.printStackTrace();
}
}
}.start();