Posts

Showing posts from November, 2021

Release method for releasing the resources when they are not in use.

  release Added in  API level 1 public void release () Releases resources associated with this MediaPlayer object. It is considered good practice to call this method when you're done using the MediaPlayer. In particular, whenever an Activity of an application is paused (its onPause() method is called), or stopped (its onStop() method is called), this method should be invoked to release the MediaPlayer object, unless the application has a special need to keep the object around. In addition to unnecessary resources (such as memory and instances of codecs) being held, failure to call this method immediately if a MediaPlayer object is no longer needed may also lead to continuous battery consumption for mobile devices, and playback failure for other applications if no multiple instances of the same codec are supported on a device. Even if multiple instances of the same codec are supported, some performance degradation may be expected when unnecessary multiple instances are used at ...

toString() method which is use in android to know the states of java Object.

  You can use log statements to figure out the state of any Java object. The easiest way to print out the contents of a Java object is to provide an implementation of the toStrin g () method. The purpose of this method is to represent the whole object as a string, usually for debugging purposes. Note:  If you concatenate (with the “+” operator) a string with a Word object, then Java will implicitly call the toString() method on the object. That means, these two statements are equivalent: Log.v("NumbersActivity", "Current word: " + word); OR Log.v("NumbersActivity", "Current word: " + word.toString());