Bundle a file inside app in Android

What I want to do is to have the user press a button of some sort and inside the method of that button I want the system to open up a file (in this case a .docx file) inside a file viewer this would have to be done via an intent but how should that be coded and where do I put my .docx file?

Answers


Android doesn't have inbuilt functionality for viewing .docx file.

for that,

Your android device should installed .docx viewer (Third party like, Documents To Go, Smart Office, Quickoffice) application then you can open that file using Intent.

something like,

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
String type = "application/msword";
intent.setDataAndType(Uri.fromFile(docx file), type);
startActivity(intent);

But if any .docx viewer is not installed then you can direct user to first install that application using Android Market and then after download that app you can open your .docx file in it.

Or you can integrate .docx viewer functionality in application using third party library. I think Apache's docx4j is in java.


Need Your Help

primefaces f:setPropertyActionListener does not take values

jsf primefaces getter-setter

I want to open a dialog box when selectbutton is pressed and that dialog box should show more detail related to the selected entry. my code is like this.

Using SignalR to find out if someone pushed a button on another website

javascript asp.net jquery signalr

I'm trying to find out if there is a way to use SignalR and be notified (in real-time) if a visitor has pushed a button on another site (different domain). First off, is SignalR the best way of doing