Reputation: 1893
I figured out how to make custom views using RemoteViews
class. I also know how to use Chronometer
and ProgressBar
inside of RemoteViews
.
But how to make a count down View
, almost exactly the same as Chronometer
but with the difference that it will be counting down instead of up?
I tried to copy the source of Chronometer
class and modify it so it will fit my needs, but there are annotations like @android.view.RemotableViewMethod
, which i can not import to my project. Unfortunately, without annotations it is not working, because RemoteViews
is using them to pass values.
My second idea was to extend the Chronometer
class and override proper methods, but they are private
.
Any ideas, is it possible? (And extra question, because I'm not sure: If the method is annotated and I override this method, is the annotation inherited?)
Upvotes: 9
Views: 3209
Reputation: 36302
I don't believe you're going to be able to use a custom class directly with RemoteViews
even if it's derived from one of the supported classes (annotations are not inherited). You could try using a TextView
, counting down in a Service
with a reference to the RemoteViews
object and updating from there.
Upvotes: 4