Hmmm... looks like Uri.fromFile() is not converting the space to %20
or +. Try doing that yourself and see if it helps.

On Wed, Apr 18, 2012 at 4:13 AM, Jovish P <[email protected]> wrote:
> 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 Developers" 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-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to