In my app we are downloading few files and using following method to open
that file.
Whenever the filename contains space, the following method is not working .
If it doesn't contains any  space it is working perfectly.


private void openDownladedReport(String filePath){
File file = new File(filePath);
MimeTypeMap map = MimeTypeMap.getSingleton();
String extension = getFileExtension(file);
if(!extension.equalsIgnoreCase("")){
String mimeType = map.getMimeTypeFromExtension(extension);
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), mimeType);
try {
startActivity(Intent.createChooser(intent, "Open with:") );
}catch (ActivityNotFoundException activityNotFound) {
                             Toast.makeText(getApplicationContext(),
"failed to open the file", Toast.LENGTH_SHORT).show();
                          }
 }else{
Toast.makeText(getApplicationContext(), "Unknown Extension",
Toast.LENGTH_SHORT).show();
}
 }
I just want to know any solutions is there other than replacing space in
the file name for this problem.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to