I want to add items from a service in a ListView which is displayed in a widget. But how can I get my ListView in the Service? My widget layout looks like this:
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
And with this Code I can get the RemoteViews from my widget:
AppWidgetManager mgr = AppWidgetManager.getInstance(ctx);
RemoteViews rv = new RemoteViews(ctx.getPackageName(), R.layout.widget_layout);
But now how can I get my ListView from the RemoteViews?
You will need a RemoteViewFactory class which is the adaptor for your ListView;
Go through this link. I guess this is exactly what you want.