2

I am trying to add programmatically created layout to remoteview

Here is my small demo but it didn't work:

LinearLayout parent = new LinearLayout(getAppContext());
parent.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
parent.setOrientation(LinearLayout.HORIZONTAL);

TextView tv1 = new TextView(getAppContext());
parent.addView(tv1);

parent.setId(0x7f03021b);

Remoteviews contentView = new RemoteViews(getAppContext().getPackageName(), parent.getId());

But the above code doesn't work.

Rushikesh Talokar
  • 1,515
  • 4
  • 16
  • 32

0 Answers0