1
File file=new File("file:///android_asset"+filename);

if (file.exists()) {
        Uri targetUri = Uri.fromFile(file);
        Intent intent1 = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(targetUri, "application/pdf");
            try {
                startActivity(intent1);
            } 
            catch (ActivityNotFoundException e) {
                Toast.makeText(FileWebView.this, 
                     "No Application Available to View PDF", 
                      Toast.LENGTH_SHORT).show();
            }
4

0 回答 0