Android :: Open A Local App File In Another App Via An Intent
Nov 8, 2010
I don't want to store said file on the sdcard in this case. The file also cannot be storage directly in the apps local files directory. It needs to be in a subdirectory, so it cannot write the file using openFileOutput() and MODE_WORLD_READABLE.
The app may download files small files like pdfs and store them locally in a subdirectory. I would like to be able to have the user open these files if they have an app that can open them.
For example here is an intent for sending a pdf:
path being something like: /data/data/packagename/files/subdir/example.pdf
That intent will open a pdf viewer, but the viewer is unable to open the file. I assume this is a permissions issue. I tried Mark Murphy's suggestion here: http://groups.google.com/group/android-developers/browse_thread/thread/4e55d869213483a9/b7270078ac1a2744?lnk=raot of using Runtime.getRuntime().exec("chmod 755 " + fileName); but it didn't make any difference. He also suggested a Content Provider but I would like to avoid it if I can because it seems like a lot just to get this file over to another app.
If the content provider is the only option, do I have to save the file to the content provider or can I just use the content provider as a pass through to get it to the other app when I need to?
My open source application needs to browse local HTML files on the SD card, and WebView is not enough because I need history and bookmarks. I wrote the following code. It correctly opens the browser, but fails to reach catalog.html and in fact it just opens whatever page was last browsed:
Uri uri = Uri.parse("content://com.android.htmlfileprovider/sdcard/ myapp/catalog.html"); Intent intent = new Intent(); intent.setData(uri); intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); startActivity(intent);
I have a WebView that I'm using to open some files stored in the assets/ directory of my project. It works fine for most of the files, but there's one in particular (and I'm sure others I haven't found) that it just will not open.Code...
Forgive me if this is a topic that has already been discussed, but I've searched for hours and can't seem to find the answer I'm looking for. I'm trying to cut my teeth on Android programming with a simple file manager app and currently have most all functions working, but I can't seem to open a selected file with the appropriate app.
I'm trying to read some local files, and ive been reading a lot of stuff about it, but i still don't know where to store the files on my phone and how to get the right path. Some say, it should be stored on /data/data/your.package.here/files but where is that, i mean i can get there when using the emulator but i have no clue how to put files in this on a real device.
All of the android examples for XmlPullParser pull from a local resource file, and all of the SAX examples pull the XML from a URL. I've been told SAX is faster, so I'm trying to use that to pull data from a local resource file (res/xml/thefile.xml)
The example code I'm working off of is here. So in that example, the code I want to change is:
URL url = new URL("http://example.com/example.xml"); ... xr.parse(new InputSource(url.openStream()));
Instead of using URL, I want to use getXml(R.xml.thefile) Is that possible, or does SAX need to get data from a URL?
Using Local XML file as a database for a android app?
I am trying to build a app with flash using a xml file as database, to read the xml from a external file from the local directory isn't a problem, the problem is how to write data from flash to the xml file.
I have a kind of an ApplicationLauncher that has to start the build-in gallery. But I dont want to get any result from that gallery... I just want to start it and want my "Launcher" to close after that.
What ive tried:
But it doestn even work with this flag... as soon as I click on a pic in the gallery, it closes and returns to my "Launcher". Is there any way to achieve what i want to do?
Does anyone know of an intent I can use to open a raw mp4 resource in the phone's video player?
I tried this code: CODE:..............
This threw an ActivityNotFoundException, however this has worked for me when the URI was the sdcard and the video was located there. Does anyone know how I can use the above code with a resource file in my app?
I thought it might be interesting to some developers. Here's a complete working example of ContentProvider for this purpose: http://blog.tourizo.com/2009/02/how-to-display-local-file-in-android. I also found a topic here: http://groups.google.com/group/android-developers/browse_thread/threa. Looks like the topic was closed and I couldn't reply there, so I created new one.
How come this is the only file manager on the market (that I've found... I went through quite a few) that can open an HTML file from your SD card? I was a loyal user of Estrogen until I found that it couldn't.
I was trying to open an Activity of an other applicatoin by using an implicit Intent. It doesn't work, I thought it is possible to start an Activity of an other Application by using implicit Intent. Or do I missunderstand it?
I added following intent-filter to the AndroidManifest of Application A:
And called the Intent in Application B by using folloing code:
All I get ist, the error message that Application A was stoped unexpectedly.
I've been trying to find out how to create an intent that will open the user's preferred browser without specifying the URL. I know how to open it by giving a specific URL like this:Intent intent = new Intent();intent.setAction(Intent.ACTION_VIEW); intent.setData (android.net.Uri.parse ("http://www.google.com")) ;context.startActivity (intent);I don't want to open the browser to any page in particular, just the set homepage or whatever page the user was on last. I've thought about looking up the homepage set within the app but you can't do it with the default Browser app because it is private. Does anybody know of a way to do this?
This should be very simple, but I can't find the answer anywhere. How do I load an html file (which I assume I keep in res/raw folder) into a webview? neither mWebView.loadUrl("file:///raw/about"); or mWebView.loadUrl("file:///raw/about.htmal"); works. What's the correct syntax or arrangement.
I am trying to get googlemaps to accept a local KML file. final Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=file://" + Environment.getExternalStorageDirectory() + "/locate.kml")); startActivity(myIntent);
The file is on the SD card, and is a valid KML file. Google Maps loads up, but says it cannot find the file. final Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=http://www.website.com/locate.kml")); startActivity(myIntent);
Works fine. geo: 0,0? q= seems to be very under documented, how to use it to refer to a local file?
I plan to have a 3gp video file that will come with the installation package, it will be placed in /files/ subdirectory, and I would like to ask the native Android media player to play it when I want that.
Here is what I have planned to do/code:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse("BattlestarGalactica.3gp"); intent.setDataAndType(data,"video/3gpp"); startActivity(intent);
However, when I try to launch the lines above, I get the following error:
And the video can not be played.
What am I doing wrong that is not applicable to Android platform?
I am working on a project for a belgium Tv Guide. Now I download a database (.db) file from a server to the sdcard to work with. In this database are 2 tabels, tvchannels and tvprograms. Now I can do several updates to the tvchannels table and i want to make a backup of this table to a lokal database file. How can i do that? I want to do this because I have to download a new database file every daye from the server and the channels that are choses are saved in the tvchannels database. I want to backup this database table and when the new database file (tvgids.db) is downloaded I want to replace the tvchannels database (from downloaded database file) with the backup from tvchannels..
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to firstname.lastname@example.org To unsubscribe from this group, send email to email@example.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
I am new to Android and relatively new to Java so please bear with me. I have an XML file stored in the res/xml that I am trying to write to. I know how to read it using XmlResourceParser, but I have not been able to find a way to write to that file locally. Could someone point me in the right direction please.
I'm a novice user writing my first android application. I have the need to upload a file to a webserver from the device. I googled enough before joining this forum and not at one place did I find a suitable solution. I would like to know how to launch the file browser when user clicks on the "Browse" button to upload a file.