picture

Archive for February, 2012

Detecting incoming and outgoing calls in Android

Wednesday, February 29th, 2012

Detecting incoming and outgoing calls in Android can be realized in several ways. One of the possibilities is to use a custom PhoneStateListener which can be attached to the TelephonyManager in your onReceive() function of the custom BroadcastReceiver. This is a “clean” way, beacause the BoradcastReceiver object is destroyed as soon as the onReceive() function is left. But if you just want to do some little stuff, you can implement your logic directly in the onReceive() function. Here how it works. (more…)

Copy text to Clipboard

Tuesday, February 28th, 2012

To copy some text to a clipboard in Android is pretty simple.

private void CopyNumber(String someText, Context context) {
     ClipboardManager clipMan = (ClipboardManager)context
                    .getSystemService(Context.CLIPBOARD_SERVICE);
     clipMan.setText(phoneNumber);
}

context parameter is required if you want to use the function outside Activities

DOJO: Refresh/update target URL for dijit.Tree

Wednesday, February 22nd, 2012

Generally, DOJO does not support a direct refresh/update of the dijit.Tree. If you want to provide your dijit.Tree object by a new target URL and refresh your dijit.Tree, there are two possibilities. The first one is to destroy your tree object completely and build up your tree again with a new store (with new target URL). But its not that elegant. The better way is to extend your dijit.Tree class by the underlying function.
(more…)