> My question was, if I can browse through sdcard and I know that the file
> is "...txt" then why can't I open it like all other files?

To quote from the documentation:

http://code.google.com/android/reference/android/content/Intent.html

"For data that is not a content: URI and where no explicit type is
included in the Intent, instead the scheme of the intent data (such as
http: or mailto:) is considered. Again like the action, if we are matching
a scheme it must be listed by the component as one it can handle. "

You are assuming that Uri.parse("file://home/sdcard.img/test.txt") yields
something that an Activity can understand and respond to. That does not
appear to be the case given your symptoms, though I haven't tried it
myself.

You may wish to try using an explicit MIME type, to see if that helps (see
Intent#setDataAndType()), but I suspect there simply is no "view a *.txt
file" activity built into the operating system. That simply means you need
to create a *.txt-file-viewer activity, no different than you might need
to create a *.doc-file-viewer activity if you wanted to view Word files,
or a *.csv-file-viewer activity if you want to view CSV files, etc.

Please bear in mind that Android is not a file-centric OS to the extent
that, say, Windows Mobile is. Neither is iPhone, near as I can tell.
Paradigms like "file browsers" that may be trivial in one mobile OS may be
somewhat more work in other mobile OSes, like Android or iPhone, just as
things that may be relatively easy on Android (e.g., mapping application)
might be excruciatingly painful on another mobile OS.

--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.1 Published!



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to