I have the following method below:
public NotificationCompat.Builder createNotification(Context context) {
Intent intent = new Intent(this, MapsActivity.
So creating the App Widget layout is simple if you know how to work with Layouts
. However, you have to be aware that App Widget layouts are based on RemoteViews
, which do not support every kind of layout or view widget. Anyway if you need asistance with App Widget layout here is some guaidance:
https://developer.android.com/guide/practices/ui_guidelines/widget_design.html
Luckily for you RemoteViews
support Chronometer
as you can see from developer webiste: https://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
A think you can acces your Chronometer
as usually and you could do something like this depends do you want it to pause, resume, whatever:
remoteView.setChronometer(R.id.myChronometere, SystemClock.elapsedRealtime(),
null, false); //pausing
You can use built in chronometer:
builder = new NotificationCompat.Builder(context)
builder.setUsesChronometer(true)
...
builder.build()