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 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?
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.
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 email@example.com To unsubscribe from this group, send email to firstname.lastname@example.org 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 would like to get the mime type of my local media file (3gpp , mp4, ...etc) if it is of video then i want to allocate a SurfaceView for it additionally otherwise i just use MediaPlayer to play it i have found opencore has provided some interface for that and used by mediascanner.cpp but it seems in android media framework it isnt so can i achieve this by using android media framework?
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 am having a file in the folder res/raw/a.xml. I want to write some data to this file? How it can be done in Android? How can we access a file stored in local directory in order to write data to that file. can anyone help me in sorting out this issue ?
I am so in trouble . Getting no guidedence over net that how to play swf file from sdcard/myswf.swf folder or data/data/package.name/flash/myswf.swf in froyo. I have froyo in my mobile and adobe flash is installed from market. But i not knowing, what code i need to write to run this local file in my Webview?
I'm now trying to implement my own content provider. My original data was stored on network or local/remote file systems, so I want to provide data via input stream. I know that client may call ContentResolver.getnputStream to retrieve the input stream to access data. But I don't know how to implement content provider in this situation, I searched the Internet but all the tutorials for content provider are talks about how to expose data that stored on local database. how to expose data that stored on file systems using a content provider? what happened when client call ContentResolver.getnputStream? I want to know how to return an input stream to my client.