Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionI apologize in advance for the "newbie" nature of this question.
Here is my predicament: I'm brand new to android and developing in general. I'm using android's SDK with eclipse Galileo. I've followed several tutorials to create different layouts. I've even learned recently how to use radio buttons and verify which ones were selected. Now I need to create a service that downloads and updates an xml file within the application. I've tried to locate a simple tutorial for services on Google's developer site but so far, so bad. If they exist could somebody point me in the right direction?
On the other hand, I've been told Google's tutorials are a little out dated. Is that true? If so, are there any other tutorials that woul开发者_JS百科d hand-hold (and possibly over-explain) how to use a service to a true newbie for free (like google)?
Any suggestions would be appreciated.
There are several open source projects you can use as an examples
http://code.google.com/p/android-sky/source/browse/#svn/trunk/Sky
http://code.google.com/p/shelves/source/browse
http://code.google.com/p/apps-for-android/
and book by commonsware and examples to this book :
http://commonsware.com/
http://github.com/commonsguy
Are you looking to upload/download local to the device or over a network connection?
Local File access should be covered by the Data Storage Tutorials The network connectivity portion of the dev guide is sparse (just lists the 2 main packages for network use), but a quick search on google finds what looks to be a good tutorial with source code: http://developerlife.com/tutorials/?p=288
I would use Java's NIO for that.
A very good example (but maybe a bit complicated at first) in this test application. See these methods: download() and specifically fastChannelCopy().
You can look at a complete DownloadFile class of the very same technique here.
About the Service itself, others have pointed nice howto.
精彩评论