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 any 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_VIEWIntentwith aUrito the document on external storage and the proper MIME type for whatever sort of file it is. UsePackageManagerandqueryIntentActivities()to see if there are any matches. If there are no matches, then the user does not have such an application installed.