想把一个pdf文件放在assets目录下
使用Intent把pdf文件地址发送给adobereader
adobereader显示这个pdf.已经实现读sdcard中的PDF文件显示
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent=getPdfFileIntent("/sdcard/A350.pdf");
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(this,R.string.NO_PDF_READER_TIP,Toast.LENGTH_SHORT).show();
}
} public static Intent getPdfFileIntent(String param)
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri localUri = Uri.fromFile(new File(param));
intent.setDataAndType(localUri, "application/pdf");
return intent;
}
使用Intent把pdf文件地址发送给adobereader
adobereader显示这个pdf.已经实现读sdcard中的PDF文件显示
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent=getPdfFileIntent("/sdcard/A350.pdf");
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(this,R.string.NO_PDF_READER_TIP,Toast.LENGTH_SHORT).show();
}
} public static Intent getPdfFileIntent(String param)
{
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri localUri = Uri.fromFile(new File(param));
intent.setDataAndType(localUri, "application/pdf");
return intent;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货