Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.Intent; import android.net.Uri; import java.io.File; public class Main { public static void openFile(File aFile, Context context) { Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW); File file = new File(aFile.getAbsolutePath()); String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString()); String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); myIntent.setDataAndType(Uri.fromFile(file), mimetype); context.startActivity(myIntent); } }