Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Konstantin Pribluda for How to show rss feed in android widget

(Assuming you got RSS retrieval and parsing correctly) You just have to change some text in widget:

    AppWidgetManager manager = AppWidgetManager.getInstance(context);
    RemoteViews views = new RemoteViews(context.getPackageName(), R.name_of_your_widget_layout);
    // set text of some view
    views.setTextViewText(R.id.widget_amount_cameras, amountCameras);
    // and of another view
    views.setTextViewText(R.id.widget_location, locationCity);
    // ... and yet another view
    views.setTextViewText(R.id.locationStatus, locationStatus);

   // get IDs of widgets ,  there could be more than  one
    final int[] appWidgetIds = manager.getAppWidgetIds(new ComponentName(YOurWidgetProviderClass.class.getPackage().getName(), YOurWidgetProviderClass.class.getName()));

    // update all hte instances
    manager.updateAppWidget(appWidgetIds, views);

You can change only some attributes of your widgets ( due to security constraints ) - See Javadoc of RemoteViews for further explanations


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>