I have tried so much to add a linearlayout(xml defined) with some dynamic textviews(runtime) to RemoteView.
I defined the linearlayout in my xml layout like:
calendarlayout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutClickable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/myshape"
android:padding="4dp" >
<LinearLayout
android:id="@+id/layoutParentView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="70dp"
android:orientation="vertical"
android:padding="4dp" >
</LinearLayout>
And tried to use it in my remoteview with some dynamic textviews.
RemoteViews remoteViews = new RemoteViews(context
.getApplicationContext().getPackageName(), R.layout.calendarlayout);
for(int i=0; i<event_row_counter; i++ ){
CalendarEvent mCalendarEvent = new CalendarEvent();
mCalendarEvent = CALENDAR_EVENTS.get(i);
TextView mTextView = new TextView(context);
mTextView.setId(i);
RemoteViews textRemoteView = new
RemoteViews(context.getApplicationContext().getPackageName(), R.layout.calendarlayout);
remoteViews.setTextViewText(mTextView.getId(), mCalendarEvent.getFormatedTime()+" "+mCalendarEvent.getTitle());
remoteViews.addView(R.layout.calendarlayout, textRemoteView);
}
I know my process is fully wrong, but I unable to found any way to add the linearlayout with dynamic textviews into the remoteview yet.
Suggestions are mostly appreciated.