In our app we are showing files stored in the sd card. We are unable to
open html file which contains space in the name in default broswer.
it invokes the default browser and shows following message "*The Web page
at ontent://com.android.htmlprovider/sdcard/company info.html?test/html
could not be loaded as: Th request file was not found.*" I am able to open
same html file in other applications like text editor. No issues while
opening html file without space in the name.
This is the method we are using in our app
public static void openDownloadedFile(final Context context, String
filePath) {
try {
File file = new File(filePath);
if(file != null && file.exists()){
Uri uri = Uri.fromFile(file);
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(uri, getMimeType(filePath));
((Activity) context).startActivity(intent);
}
} catch (ActivityNotFoundException activityNotFound) {
DialogTemplate.getNeutralDialog(
"No application has been installed to support this file!",
"Ok", context).show();
}
catch (Exception exception) {
DialogTemplate.getNeutralDialog(
"Failed to open the file. Please try again",
"Ok", context).show();
}
}
Regards,
Jovish
--
You received this message because you are subscribed to the Google Groups
"Android Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/android-discuss?hl=en.