You can set an attribute only before view's inflation. After view has
been inflated, the only thing you can resort to is calling view's
method that will change its state. Right now, methods offered by
RemoteViews is the only way to communicate with widget. I think you
can help us solve your
Can some one please help me understand the setString function in
RemoteViews?
public void setString (int viewId, String methodName, String value)
Can I pass any method name to setString ? I have a custom view in my
xml layout file. I'm passing the view id of my custom view, name of a
Thanks Mark. Yes it is my own view class (like a button). But it works
fine in RemoteView as long as I do not attempt to set
anything in my view class. But one of the parameters in this view
class is dynamic and I need to set it from the Remote View (like we do
a setText for a button). That is
Let us keep aside the fact that I'm using a custom view. Consider a
normal case,
where I am using an existing Android view, for example AnalogClock
class in my layout. Is there anyway I can call a public method
of AnalogClock Class through the remote view? I need to dynamically
update something
Yes, you can call a public method on widget's views via the remote
views as long as it matches signature of 1 of methods that RemoteViews
class offers. For example, to set text on the TextView that exists in
widget's layout, you can use RemoteViews.setString(R.id.your_view_id,
setText, your
Thanks Paul. That was helpful. In my case, the public method I'm
trying to call, does not match with
the signature of any of the methods that RemoteView class offers. I
guess that explains the error I get.
Is there any way to overcome this limitation? Also, I'd like to know
if there is any other
6 matches
Mail list logo