Overloading Unary Operators in Scala <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>

When overloading an unary operators in Scala we should precede the operator name with ‘unary_’. Not doing so we will get an exception when using it. The following code sample shows that. package il.ac.hit.samples object Program { def main(args: Array[String]) { val ob = new RationalNumber(1,3) val other = -ob println(other) } } class RationalNumber(a:Int,b:Int) […]

Developing Android Broadcast Receiver <font size=-2><a href=http://www.lifemichael.com/en/?page_id=73 target=_blank>PRO</a></font>

In order to develop an android broadcast receiver we should define a class that extends BroadcastReceiver, implement our onReceive method and update the android platform about the new broadcast receiver, either via the manifest xml file or by calling the registerReceiver method. The following code sample includes the definition of a BroadcastReceiver that will get […]