I am creating a widget for an Android application (in Java, of course). I have classic RemoteViews created from a layout (using the layout id)
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.view);
and I need to edit or change the view (identify by id). In the classic view, it is easy using the findViewById function.
View v = ... //inflate layout R.layout.view View my = v.findViewById(R.id.myViewId); processView(my); //filling view
But in RemoteViews, it is not supported. It is possible to get the view using apply (), but after processView and reapply () I don't see the changes in the view.
View v = rv.apply(context, null); View my = v.findViewById(R.id.myViewId); processView(my); //this work fine rv.reapply(context,my);
The second, worst option is to get my necessary form of the RemoteViews view, process it, delete the old view, and add the processed new view using addView ().
RemoteViews rv = ... View my = ... //apply, find and process //remove old view RemoteViews rvMy = ... //create RemoteViews from View rv.addView(rvMy)
But I do not know how to create RemoteViews from a view (maybe?). Any ideas how to solve this problem?
java android widget
honzakuzel1989
source share