android - RemoteViews addView function returns errors on AppWidget -


i'm trying create appwidget displays number of items (which can change). i'd generate textviews dynamically, assume using:

remoteviews updateviews = new remoteviews(context.getpackagename(), r.id.widgetmain); remoteviews newview = new remoteviews(context.getpackagename(), r.id.widgetitem);  updateviews.addview(0, newview); 

but returns problem loading widget error. widgetitem.xml textview within linearlayout. widgetmain.xml 2 textviews within linearlayout.

what doing wrong?

updateviews.addview(0, newview);

you should specify correct viewid rather 0 parent of widgetitem. exmaple, can add empty container under widgetmain purpose.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -