View MS office files in an android application
I am trying to view files in my application such as audio, video , PDF and others.
I have successfully done that, now I am trying to view Microsoft office files such as doc, docx, xls and ppt.
Is there an开发者_C百科y way to do that in android, like calling an Intent?
I am so appreciated for any help or guide.
Edit
I have downloaded thinkfree office to my nexus S, but the following code still returning false, kindly look at it:
private boolean checkViewerAvailability(String type)
{
PackageManager packageManager = getPackageManager();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("application/doc");
List<ResolveInfo> list = packageManager.queryIntentActivities(intent,PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
You can try. Create an ACTION_VIEW
Intent
with a Uri
to the document on external storage and the proper MIME type for whatever sort of file it is. Use PackageManager
and queryIntentActivities()
to see if there are any matches. If there are no matches, then the user does not have such an application installed.
Don't exactly get your use case, but Google docs will accept and translate those formats to native Gdocs that can be edited on android.
精彩评论