Possible Duplicate:
Intent for editing plain text file with the installed file editor (if any)
I am trying to open some text file which I have downloaded. When I start the activity with intent it gives ActivityNotFound Exception.
try {
Uri path = Uri.parse(path+"/sampletext.txt");
Intent intent = new Intent(Intent.ACTION_VIEW);
PackageManager packageManager = ctx.getPackageManager();
intent.setType("text/plain") ;
List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0 ) {
intent.setDataAndType(path, "text/plain");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
ctx.startActivity(intent) ;
}
} catch (Exception e){
e.printStackTrace() ;
}
When I debugged, I found that the list.size is 1.
Is there any other information which I am missing?
Any kind of points would help me.
Thanks.