我在模拟器里保留了一份pdf文件,并且安装过**adobe reader**。我试过用下面的代码读取模拟器的pdf文件
代码:
File file =
new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/iTunes Connect.pdf");
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setDataAndType(path,"application/pdf");
try
{
startActivity(intent);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(xv.this,
getString(R.string.app_name),
Toast.LENGTH_SHORT).show();
}
但是报出:file path is not valid
怎么解决?
new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/iTunes\\ Connect.pdf");