Android – Get time of chronometer widget

If you look at the source of the Chronometer class, you’ll see that it doesn’t store the elapsed time in a field and it calculates it internally every time it needs to update the display. However it’s relatively easy to do the same in your own code: long elapsedMillis = SystemClock.elapsedRealtime() – chronometerInstance.getBase(); This assumes … Read more

Multiple Instances of Pending Intent

So happens that after posting my question, I came up with an answer. I pass in my appWidgetId as the “unique” request code and voila! Here is the snippet now: Intent openApp = new Intent(context, RunningTally.class); openApp.putExtra(“widgetId”, appWidgetId); PendingIntent pendingAppIntent = PendingIntent.getActivity(context, appWidgetId, openApp, PendingIntent.FLAG_CANCEL_CURRENT); views.setOnClickPendingIntent(R.id.openFull, pendingAppIntent);

Widget – Iframe versus JavaScript

I was searching about the same question and I found this interesting article: http://prettyprint.me/prettyprint.me/2009/05/30/widgets-iframe-vs-inline/ Widgets are small web applications that can easily be added to any web page. They are sometimes called Gadgets and are vastly used in growing number of web pages, blogs, social sites, personalized home pages such as iGoogle, my Yahoo, netvibes … Read more

Fire jQuery event on div change

You can use DOMNodeInserted and DOMNodeRemoved to check if elements are added or removed. Unfortunately, IE doesn’t support this. $(‘#myDiv’).bind(‘DOMNodeInserted DOMNodeRemoved’, function(event) { if (event.type == ‘DOMNodeInserted’) { alert(‘Content added! Current content:’ + ‘\n\n’ + this.innerHTML); } else { alert(‘Content removed! Current content:’ + ‘\n\n’ + this.innerHTML); } }); Update You could save the initial … Read more

How should I customize DropdownButtons and DropdownMenuItems in Flutter?

You can accomplish this by wrapping the DropdownButton in a Theme widget and overriding the canvasColor. import ‘package:flutter/material.dart’; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { State createState() => new MyHomePageState(); } class … Read more

How to implement expandable panels in Android?

Thanks very much OP! For anyone interested I took OP’s solution and refined it a bit. Handle only displays if there is overflow Added ability to specify animation duration via ‘animationDuration’ attribute Added ability to attach event listeners that get fired onExpand and onCollapse (this is useful for e.g changing the text of the “More” … Read more

How to embed Javascript widget that depends on jQuery into an unknown environment

After reviewing some answers and pointers, and finding some helpful jQuery hackers, I ended up with something like the following: (function(window, document, version, callback) { var j, d; var loaded = false; if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { var script = document.createElement(“script”); script.type = “text/javascript”; script.src = “https://stackoverflow.com/media/jquery.js”; script.onload … Read more