i m 试图从我的 raw子上通过card子,以示意。
在我宣布开幕时,我向我说,国防军已经瘫痪。 既然我对上游如何运作并不抱着很大的压力,我认为这个问题来自那里。
final String extStorageDirectory = Environment
.getExternalStorageDirectory().toString();
final String festivalDirectory_path = extStorageDirectory
+ Constants.PDF_STORAGE_PATH;
File pdfOutputFile = new File(festivalDirectory_path, "/");
if (pdfOutputFile.exists() == false) {
pdfOutputFile.mkdirs();
}
File pdfFile = new File(pdfOutputFile, nameOfThePdf);
try {
InputStream in = getResources().openRawResource(R.raw.blablublo);
FileOutputStream out = new FileOutputStream(pdfFile);
byte[] buffer = new byte[1024];
int bufferLength = 0;
while ((bufferLength = in.read(buffer)) > 0) {
out.write(buffer, 0, bufferLength);
}
out.close();
} catch (Exception e) {
Log.e("tag", e.getMessage());
}
Uri path = Uri.fromFile(pdfFile);
// Uri path = Uri.parse(Constants.SPLASH_URI + R.raw.cartecannotpdf);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
希望有人能帮助我!
th
Renaud