I want to show csv file in a viewer when a csv viewer installed in phone. otherwise I need to show a toast message "There is no CSV viewer installed".
In my case, when I test below code in a device with no csv viewer installed in it.
I am not getting ActivityNotFoundException. as a result, my toast message was not shown. could you please help
Uri uri = Uri.parse(pdfUrl);
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "text/csv");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(getActivity(), "There is no CSV viewer installed", Toast.LENGTH_SHORT).show();
}