Javascript – Common methods for Build-in classes

Javascript – Common methods for Build-in classes

Date Array You can also define an array var a = new Array(); or with initial values: var a = new Array(11, 22, 33, 44); if you put only one argument then you specify the length of the array: push(element) – add a new array element at the end pop() – deletes the last element join(char) – joins all the elements of an array with the character you specify and return it as a string splice(start, end) – removes elements splice(start, howMany to removed, newElement, newElement…) – you can replace…

Javascript – Common methods for Build-in classes Read More

Android – Service – Lifecycle, hook methods and start/stop a service – Part 2

Android – Service – Lifecycle, hook methods and start/stop a service – Part 2

You can read part 1 here. service hook methods onCreate() – The service is being created and this method is launched only one. It is used to initialize the service. onStartCommand() – The service is started because of startService(). This method is called every time intent is sent via startService() – only for started service onBind() – A client is binding to the service via bindService(). All the intent extras are not visible here. – only for bound service onUnbind() – is called when all clients have been disconnected via…

Android – Service – Lifecycle, hook methods and start/stop a service – Part 2 Read More

Android – Activity callback/hook methods PART 3

Android – Activity callback/hook methods PART 3

You can read Part 1 and Part 2. This part will cover the 7 hook methods: onCreate() – It is called first when activity launched and it is called only one time. Here you initialize the views, bind data to lists etc. Next is onStart() onStart() – It is called when the activity is becoming visible to the user. Next is onResume() only if the activity was at the background and now comes to the foreground. onResume() – It is when the activity starts interacting with the user and it…

Android – Activity callback/hook methods PART 3 Read More

Java – Abstract classes & methods

Java – Abstract classes & methods

Abstract class is a class where its implementation is incomplete or non-existent. Abstract class cannot be instantiated but can be extended. A subclass that implements an abstract class can be instantiated. Abstract class is similar to interface but also have some differences. Both cannot be instantiated and both can contain methods without implementation. The differences are: a class can extend only one class but can implement many interfaces separating them with “,” An abstract class can define fields that are not static nor final. An interface all fields must be…

Java – Abstract classes & methods Read More

Java – Classes and methods

Java – Classes and methods

Method is a group of statements to which we give a name so we can execute them. When we call a method, the program first executes the statements in the method and then it continues with the code below the method call. syntax: modifier returnType methodName(Parameters){ statement(s) } modifier: (access modifiers) public | private | protected and (non-access modifiers) static | final | abstract returnType: If the method returns a value then you should specify the type here. Use return as the last statement in the method. If not then…

Java – Classes and methods Read More