14
Android Libraries and APIs

Creating your own Android library and documenting it with Javadocs

Embed Size (px)

Citation preview

Page 1: Creating your own Android library and documenting it with Javadocs

Android Libraries and APIs

Page 2: Creating your own Android library and documenting it with Javadocs

Software Library Collection of “implementations”, with easy to call

hooks. Helps remove redundancy of similar functionality

from apps Helps abstracting higher level development away

from lower level development Static library -> Built and distributed with the app Dynamic library -> linked from the software

Page 3: Creating your own Android library and documenting it with Javadocs

Application programming interface

How software components should interact Can be in form of a library or just documentation ABI = Application Binary Interface; for closed

source binary function call hooks Some APIs are internationally standardised In procedural languages -> like header files In OOP languages -> like importable classes

Page 4: Creating your own Android library and documenting it with Javadocs

Software Development Kit Set of tools to create a software for a

particular platform. Usually a set of APIs, building tools and

configs, debugging & testing utilities SDK's license can dictate the freeness of the

software you develop A non-distributable copy of platform could

be part of sdk

Page 5: Creating your own Android library and documenting it with Javadocs
Page 6: Creating your own Android library and documenting it with Javadocs

Libraries in Android .jar -> are just Java libraries .jar libraries are mostly functionality based

libraries, where data handling, data manipulation, service/framework integration is handled

Generally cannot be used to implement UX/UI features as android resources not present

Page 7: Creating your own Android library and documenting it with Javadocs

Libraries in Android .aar -> android library Contain java code along with android

resources and also android manifest stubs Project structure exactly as an Android app **Support only recently added in Android

Studio 0.5.0

Page 8: Creating your own Android library and documenting it with Javadocs

Libraries in Android Open source libraries -> distributed as

form of the whole directory structure from where project was built

Need to import the whole project into IDE and add it as a module on which your App depends

Page 9: Creating your own Android library and documenting it with Javadocs

Creating your own Android Library

Step 1 : Decide whether to use only-java library or a full android library

Step 2 : Create data-agnostic functions/classes in library. Keep in mind various different apps will use the library

Step 3 : Make sure functions to be used by client program are public and everything else private

Page 10: Creating your own Android library and documenting it with Javadocs

Creating your own Android Library

Step 4 : Properly document the usage of the library. If not for anyone else but for yourself

Step 5 : Test properly for all use cases and corner cases

Step 6 : Decide distribution methodology (open source, binary etc)

Step 7 : Distribute, share documentation, popularise, rejoice !!

Page 11: Creating your own Android library and documenting it with Javadocs

Need for documentation A library is written for third party usage The person who will develop a software

using your library needs to know how to make best use of your library

Even open source libraries must have proper documentation because you should not expect 3rd party to understand your code.

Page 12: Creating your own Android library and documenting it with Javadocs

Javadoc : Documenting Java code

Generally documentation invloves writing comments in code. Javadoc takes the step further.

Write comments in code in javadoc format, then run javadoc on the source, and get autogenerated software-manual like HTML pages

Page 13: Creating your own Android library and documenting it with Javadocs

Javadoc : Documenting Java code

Basic structure : enclose in /** <comment> */

Page 14: Creating your own Android library and documenting it with Javadocs

Javadoc : Documenting Java code