24.02.2011 1:12, Mark Murphy ?????:
It should be. It certainly works elsewhere.
http://developer.android.com/resources/samples/Wiktionary/index.html
About the Wiktionary sample (I'm sure yours is perfect :)
I remember looking at it about a year ago, and it was using a plain
Service, doing its networking from the UI thread.
Just checked, it looks like that's still the case.
public static class UpdateService extends *Service *{
@Override
public void onStart(Intent intent, int startId) {
// Build the widget update for today
RemoteViews updateViews = *buildUpdate*(this);
// Push update for this widget to the home screen
ComponentName thisWidget = new ComponentName(this,
WordWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);
}
BuildUpdate does:
SimpleWikiHelper.prepareUserAgent(context);
pageContent =
SimpleWikiHelper.*getPageContent*(pageName, false);
getPageContent calls getUrlContent:
protected static synchronized String *getUrlContent*(String url)
throws ApiException {
// Create client and set our specific user-agent string
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
request.setHeader("User-Agent", sUserAgent);
try {
*HttpResponse response = client.execute(request);*
So - not a good example for studying / copying.
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en