2012-05-10 8 views

答えて

0

おそらく、PDFの表示をAdobe Readerなどの別のアプリケーションに渡すのが最善の方法です。私たちは、ユーザーが使用可能なPDFリーダーを持っていないシナリオを占めてもすべき

Intent i = new Intent(Intent.ACTION_VIEW); 
File pdf = new File(FILE_LOCATION); 
i.setDataAndType(Uri.fromFile(pdf), "application/pdf"); 
startActivity(i); 

:テントを使用して

スクロールアクティビティを使用する方法

Intent i = new Intent(Intent.ACTION_VIEW); 
File pdf = new File(FILE_LOCATION); 
i.setDataAndType(Uri.fromFile(pdf), "application/pdf"); 

List<ResolveInfo> list = getPackageManager().queryIntentActivities(i, 
       PackageManager.MATCH_DEFAULT_ONLY); 
if(!list.isEmpty()){ 
    startActivity(i); 
}else{ 
    Toast.makeText(this, "A PDF reader is required to open this.", Toast.LENGTH_LONG).show(); 
} 
0
First u install the acrobat reader in ur emulator and the u view ur pdf file in emulator. 
Download acrobat reader apk and install in emulator using this command from command line. 
1. Go to start and open run. 
2. type cmd and type "adb -e install FilePath" press enter. 
Then u go to ur application and write this code for viewing pdf in acrobat reader. 
Intent i = new Intent(Intent.ACTION_VIEW); 
File pdf = new File(<File name whit full path>); 
i.setDataAndType(Uri.fromFile(pdf), "application/pdf"); 
startActivity(i); 
+0

PDFの次のページをインテントで表示するとき –

+0

pdfビューのアクティビティを開始するとAcrobat Readerで表示されます。そのビューでは、ファイル内のすべてのページをスクロールして表示します。ファイルのすべてのページが開きます。 –