I'm trying to create a AppWidget that displays a number of items (which can change). I'd like to generate TextViews dynamically, I assume I do this by using:
RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.id.widgetmain); RemoteViews newView = new RemoteViews(context.getPackageName(), R.id.widgetitem);
updateViews.addView(0, newView);
But this returns a "Problem loading widget" error. The widgetitem.xml is just a TextView within a LinearLayout. The widgetmain.xml is two TextViews within a LinearLayout.
What am I doing wrong?