更新时间:2023-09-28 09:33:04
我必须使用浏览器打开它。
块引用>我不知道在行星表面的任何Web浏览器,其他的或许比IE浏览器,这是能够显示本地Microsoft Word文档。我不知道任何Web浏览器为Android,它能够显示本地Microsoft Word文档中。
至于你的Java源代码code片断:
的text / html
不是MIME类型为Microsoft Word。- 决不要硬code路径如
/ SD卡
,特别是因为它是错误的许多设备。使用Environment.getExternalStorageDirectory()
来获得在外部存储的根源。- 只需创建一个
意图
对你一点好处。如果你想使用的用户可能已经安装了一些文档查看器来显示Word文档,您需要在意图$使用
ACTION_VIEW
C $ C>的构造函数,然后设置路径/类型,你在做什么,然后调用startActivity()
。
在manifest文件中我写道:
块引用>我不知道这是为什么在这里。这当然没有什么明显的与你的Java code片段,它有什么明显的做了这个问题。
我要打开一个浏览器里面的ValidateLibrary.doc文件。我该怎么做呢?
块引用>第1步:写一个Web浏览器
第2步:增强您的Web浏览器能够显示Microsoft Word文档。这可能涉及你有许可一些专利,可能会采取一些开发人员十年来写。
第三步:说服用户安装的Web /字浏览器
这将是简单的为您只需启动了一个
ACTION_VIEW
意图
上的Word文档,然后直接用户到市场上安装一些处理Word文档的第三方应用程序,如果用户没有安装的。I have a .doc file stored in the SD card. I have to open it using the browser. I used
Intent intent = new Intent(); File file = new File("/sdcard/ValidateLibrary.doc"); intent.setDataAndType( Uri.fromFile(file),"text/html");
in the manifest file i wrote:
<activity android:name=".TextFileShow"> <intent-filter> <action android:name="myaction"/> </intent-filter> </activity>
But it opens the "message compose".
I have to open the ValidateLibrary.doc file inside a browser. How do i do that?
I have to open it using the browser.
I am not aware of any Web browser on the face of the planet, other than perhaps Internet Explorer, that is capable of natively displaying Microsoft Word documents. I am not aware of any Web browser for Android that is capable of natively displaying Microsoft Word documents.
With regards to your Java source code snippet:
text/html
is not the MIME type for Microsoft Word.- Never hardcode paths like
/sdcard
, particularly since it is wrong for many devices. UseEnvironment.getExternalStorageDirectory()
to get at the root of external storage.- Just creating an
Intent
will do you little good. If you want to display a Word document using some document viewer that the user might have installed, you would need to useACTION_VIEW
in theIntent
constructor, then set the path/type as you are doing, then callstartActivity()
.in the manifest file i wrote:
I have no idea why this is here. It certainly has nothing obvious to do with your Java code snippet, and it has nothing obvious to do with this question.
I have to open the ValidateLibrary.doc file inside a browser. How do i do that?
Step #1: Write a Web browser.
Step #2: Augment your Web browser to be able to display Microsoft Word documents. This may involve you having to license some patents and will probably take a few developer-decades to write.
Step #3: Convince users to install your Web/Word browser.
It would be simpler for you to simply start up an
ACTION_VIEW
Intent
on the Word document, then direct users to the Market to install some third-party application that handles Word documents if the user does not have one installed.