在我的Andr​​oid应用程序查看Excel文件我的、应用程序、文件、oid

2023-09-12 22:58:03 作者:大姨妈不要伤害她

我工作的一个Android应用程序中,我要打开和放大器;关闭Excel按钮点击文件。这些Excel文件将是只读的。关闭Excel文件后,就应该直接我的应用程序。

I'm working on an Android app in which I have to open & close excel files on button click. These excel files will be readonly. After closing the excel file, it should direct me to the app.

请给我建议的方式来做到这一点。

Please suggest me a way to do this.

推荐答案

在这里是一个手动路由。

here is a manual route.

如何读取使用JXL excel文件2.6.12罐

但这里是一个小更容易之一。

but here is a little more easier one.

open应用

但我猜你必须找出 MIME类型

修改

得到了MIME类型,以及

got the mime type as well

Setting MIME类型的Excel文档

更新

让这样的事情可能会奏效。

so something like this might work.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/vnd.ms-excel");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);


try {
    startActivity(intent);
} 
catch (ActivityNotFoundException e) {
    Toast.makeText(OpenPdf.this, "No Application Available to View Excel", Toast.LENGTH_SHORT).show();
}