Android examples for Intent:Open File
get Text File Intent
//package com.java2s; import android.content.Intent; import android.net.Uri; import java.io.File; public class Main { public static Intent getTextFileIntent(String param, boolean paramBoolean) { Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (paramBoolean) { Uri uri1 = Uri.parse(param); intent.setDataAndType(uri1, "text/plain"); } else {/*from ww w . j av a 2s . c om*/ Uri uri2 = Uri.fromFile(new File(param)); intent.setDataAndType(uri2, "text/plain"); } return intent; } }