Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid RemoteViews addView only first view showing
    text
    copied!<p>I've seen several posts about this, but found no answers to the issue that I'm experiencing. I'm dynamically filling a LinearLayout in a homescreen widget with RelativeLayout views, but only the first child view is displaying. Debugging shows that multiple views are being created and added, but they don't appear. Here's the code:</p> <pre><code>RemoteViews views = new RemoteViews(getPackageName(), R.layout.widget); Cursor statuses_styles = getContentResolver().query(Uri.withAppendedPath(Statuses_styles.CONTENT_URI, widget), new String[]{...}, null, null, Statuses_styles.CREATED + " DESC LIMIT " + page + ",-1"); Log.d(TAG,"statuses count:"+statuses_styles.getCount()); if (statuses_styles.moveToFirst()) { int count_status = 0; views.removeAllViews(R.id.messages); while (!statuses_styles.isAfterLast() &amp;&amp; (count_status &lt; 16)) { RemoteViews itemView; itemView = new RemoteViews(getPackageName(), R.layout.widget_item); itemView.setTextViewText(R.id.message, statuses_styles.getString(1)); itemView.setFloat(R.id.message, "setTextSize", friend_textsize); Log.d(TAG,"add view:"+statuses_styles.getString(1)); views.addView(R.id.messages, itemView); count_status++; statuses_styles.moveToNext(); } } statuses_styles.close(); mgr.updateAppWidget(appWidgetId, views); </code></pre> <p>The widget is simply a LinearLayout with the id of "messages". It's set to fill_parent for width and height and has orienation set to vertical.</p> <p>The widget item is a relative layout containing some text and image views.</p> <p>The widget is a 4x4.</p> <p>Any ideas why none of the other views are appearing?</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload