Java tutorial
//package com.java2s; import java.io.File; import android.content.Intent; import android.net.Uri; public class Main { private static Intent getTextFileIntent(File file) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile(file); intent.setDataAndType(uri, "text/plain"); return intent; } }