Oh, yeah, I just noticed it was using a service and linked to it, thinking it might be a simpler example than the other one.
On Wed, Feb 23, 2011 at 5:26 PM, Kostya Vasilyev <[email protected]> wrote: > 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- 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

