
可以在Android上阅读pdf文件,该怎么办?
解决方法:
您最多可以做的是调用另一个程序来打开该程序(仅在安装了Quickoffice的情况下有效)
public class Openpdf extends Activity { @OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.main); button button = (button) findVIEwByID(R.ID.Openpdfbutton); button.setonClickListener(new VIEw.OnClickListener() { @OverrIDe public voID onClick(VIEw v) { file file = new file("/sdcard/example.pdf"); if (file.exists()) { Uri path = Uri.fromfile(file); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, "application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_top); try { startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(Openpdf.this, "No Application Available to VIEw pdf", Toast.LENGTH_SHORT).show(); } } } }); }} 总结 以上是内存溢出为你收集整理的android-阅读PDF文件全部内容,希望文章能够帮你解决android-阅读PDF文件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)