Building Android Application – Activity Types – Part II (Full Screen)

This is the second part of the Activity types series, where we will take a look at the Empty activity and the full screen activity, If you wish to work with the simple activities, you can refer to my earlier post here.

3. Empty Activity

As the name suggests, this type of activity is not really an activity type, but a way of working. Empty Activity means, that the wizard will provide us with the files required, but it provides nothing else. It gives an empty implementation of the Activity class.

What do I get from the wizard?

1. We get the standard .java file extending Activity class, but all it contains is the setContentView(<<xml>>) method invocation that puts the view onto the screen.

2. We get one XML file containing the basic single TextView component, nothing more and nothing less. One interesting this that we can notice here is that the way the root tag (in this case RelativeLayout) is configured. For a standard activity the root tag looks like this:

<RelativeLayout xmlns:android=""
    tools:context="com.example.acitivitydemo.MainActivity" >

while the root tag for an empty activity looks like this:

<RelativeLayout xmlns:android=""
    tools:context="${relativePackage}.${activityClass}" >

It does not talk about any kind of padding to the layout, this is because, there is supposed to be no component added at the time of design. It’s an Empty Activity. If you are wondering what is this “$” sign confusion, rest assured, it is just a way through which the configuration file is letting the runtime understand which Activity class is associated with the layout file.

This is similar to the tools:context in the earlier XML example, where it is explicitly mapped.

3. As always, we also get the strings.xml file for i18n support.

What do I need to do to make it execute?

Nothing extra, this is an empty activity, hence it is not supposed to be having anything, hence just execute it without any modifications.

What will be required to create an application?

Everything, as the wizard provided components do not carry anything, we will have to add the components and write the corresponding Java code.

Where to use it?

Anywhere that you wish to create an activity. This gives you a blank slate that you can use to create whatever it is that you want. It can become a map activity, a sensor activity, a service or a standard UI activity. It is your choice.

My recommendation

I personally feel that this is a useless type of activity as it just replicates what we get by using the blank activity without fragments (explained in the earlier post here).

4. Full Screen Activity

Technology, whichever it may be, is based purely on common sense (this is a theme I will keep on repeating). Full Screen Activity, the name itself suggest what this is all about. It provides us with a UI that uses the entire device screen for rendering the UI components. The idea behind having this activity type is to make the application more immersive, so that the user is not disturbed / sidetracked by the system bars like Action bars etc.

This is the first of the advanced activity types available post KitKat release. Hence, it will require some extra explanation beyond the standard options.

What do I get from the wizard?

1. We get one .java file which is embedded with all the code necessary to build a full screen activity and hence will have lots of pre-built code available.

public class FullscreenActivity extends Activity {
     * Whether or not the system UI should be auto-hidden after predefined time
    private static final boolean AUTO_HIDE = true;

* time used by the AUTO_HIDE in miliseconds
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
* If set, will toggle the system UI visibility upon interaction.
private static final boolean TOGGLE_ON_CLICK = true;
private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;
private SystemUiHider mSystemUiHider;

The variables defined here, will be used to control the behaviour of the screen as to whether it should go into full screen mode after user interaction.

By default the activity will run in a full screen mode, but upon user interaction it will show the system bars depending on the direction in which we swipe the screen. The code which enables the listening of user interaction is to be written in the onCreate() method.

Partial code:
        final View controlsView = findViewById(;
        final View contentView = findViewById(;

// Set up an instance of SystemUiHider to control the system UI for
// this activity.
mSystemUiHider = SystemUiHider.getInstance(this, contentView,
.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
// Cached values.
int mControlsHeight;
int mShortAnimTime;

Here we are taking the controls defined in the XML (We will see this shortly), and which correspond to the entire screen. System UI hider class is generated for you by the wizard, and due to it’s inherent complexity, we will not be getting into discussions pertaining to it (maybe at a later date), suffice it to say that this class accepts flags, which will decided which part of UI to hide. Currently it has three possible flags:

  1. FLAG_LAYOUT_IN_OLDER_DEVICES – this is typically used to make a full screen appear in older devices
  2. FLAG_FULLSCREEN – used to toggle the visibility of the status bar.
  3. FLAG_HIDE_NAVIGATION – toggles the visibility of the navigation bar.

These values are defined in the wizard generated SystemUiHider class and we customize it in our activity class.

    private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;

Using an instance of the SystemUiHider class, we can now associate a visibility change discerning listener, which will perform operations whenever the UI visibility changes, in other words, when a human intervention is encountered.

                .setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
                    // Cached values.
                    int mControlsHeight;
                    int mShortAnimTime;

public void onVisibilityChange(boolean visible) {
// If the ViewPropertyAnimator API is available
// (Honeycomb MR2 and later), use it to animate the
// in-layout UI controls at the bottom of the
// screen.
if (mControlsHeight == 0) {
mControlsHeight = controlsView.getHeight();
if (mShortAnimTime == 0) {
mShortAnimTime = getResources().getInteger(
.translationY(visible ? 0 : mControlsHeight)
} else {
// If the ViewPropertyAnimator APIs aren’t
// available, simply show or hide the in-layout UI
// controls.
controlsView.setVisibility(visible ? View.VISIBLE
: View.GONE);

if (visible && AUTO_HIDE) {
// Schedule a hide().

This seems to be a too complicated code, but you need not focus on the code if you are a fresh entrant to Android, in case you wish to understand what the code does, please focus on the implementation of the onVisibilityChange() method. In this method, depending on the API (Honeycomb has a different way of implementing it) and the visibility status, the visibility of the components is being changed.

You will also be getting readymade functions like onPostCreate(), in which you can customize how the first visibility change should execute. delayedHide() where you can customize the delay of toggling the visibility.

2. We get an XML file in which we define the components for representing the full screen.

<FrameLayout xmlns:android=""
    tools:context="com.example.acitivitydemo.FullscreenActivity" >
         The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc.
         We have used a TextView to render a text, but you can have a VideoView, if you
         are building a video player. Similarly, other components should be used.
        android:textStyle="bold" />
         This FrameLayout insets its children based on system windows using
        android:fitsSystemWindows="true" >
            tools:ignore="UselessParent" >
                android:text="@string/dummy_button" />

For brevity’s sake, I have removed certain attributed related to text colours, background etc. You can choose it at your discretion.

The screen looks something like this.

Full Screen Layout

3. We get one strings.xml file in which values for i18n are available.

What do I need to do to make it execute?

Again, you need to do nothing, as wizard has done everything for you to execute.

What will be required to create an App?

You will need to replace the default TextView component in the XML with the component of your choice. In the Java code, you will need to integrate this component along with the SystemUiHider so that the activities associated with the user interaction can be handled alongwith the UI hiding.

Where to use it?

This activity type should NOT be used for standard UI / Data entry / Data rendering kind of tasks. The purpose of this activity is to make the user experience immersive so that the user does not get distracted by anything else on the screen. In situations where the content is most important part of the application, this activity can be used.

My Recommendation

I think, this activity is a perfect fit for building an application that deals with multi-media content. For example, a Video player, or a photograph viewer, or a text editor. There are two reasons for such a recommendation:

  1. The activity demands maximum utilization of available screen space.
  2. Minimum distraction, while the activity is running.

Summarizing the post:

As always the intricacies of Android does not cease to surprise me, hence instead of tagging on the Login Activity to an already overflowing post, I defer it to the next post.

Building an Android application – Activity Types – Part I

Last post, we have seen how to build a simple application just by selecting the default values during application building wizard process. We did not focus on what alternates were available. Starting this post, we will be taking a look at each and every possible alternates that can be used, and we will also try to understand where it can be used. In this post, I will be taking a look at the different activity types available for selection.

Any User Interface (UI) in Android is called as an Activity, While a developer can create an activity by typing in the code, most prefer to go to wizard to build an Activity. There are different types of ready-made activity templates available and should be used as required. The available types of activity are as listed.

  1. Blank Activity
  2. Blank Activity with Fragment
  3. Empty Activity
  4. Full Screen Activity
  5. Login Activity
  6. Master / Detail Flow
  7. Navigation Drawer Activity
  8. Settings Activity
  9. Tabbed Activity

We will take each activity and try to understand how and where to use it. We will split the discussion in two parts, and cover the standard activities first and then take up the advanced activities in the next post.

1. Blank Activity

This is the most commonly used Activity type and the one used by beginners who do not know any else.

What do I get from Wizard?

  1. We get one XML file, which defines the default layout with Relative Layout and one default TextView component that displays, “Hello World”.
  2. We get one .java file, which extends the default Android activity class and provides the over-ridden onCreate() method. This method provides the basic code for instantiating the layout and displaying the default text.
  3. We get one string.xml file, which contains the key-value pair of Strings used for i18n.

What do I need to do to make it execute?

Nothing, you just need to run the code, and it will display “Hello World” on the emulator (We have not talked about how to create an emulator, but that will come in a later post).

What will be required to create an app?

The wizard gives us just the basic code, it is nowhere near working application. There are two things that we will have to do.

  1. Go to the Design screen and drag-drop the components that you think is going to be required for building the requirements of the user.
  2. Get a reference to the components in the Java code using the auto generated (more on this later).

Where to use it?

You can use this type of activity for any kind of application, as this will be a base activity. You can even generate the same features listed in other advanced activity types by extending this basic activity.

My Recommendation

When you are not sure what type of execution your activity is going to be involved with this would be the best option available, as it can run on any Android device regardless of the version installed. For standard activities that are supposed to accept user data and send it for processing, this activity would be a best fit.

2. Blank Activity with fragment

This activity is similar to the activity discussed earlier, the only difference is that now you are equipped to work with fragments (as introduced in version 3.x). For applications targeting devices sporting versions higher than 4.x, this activity should be the default activity.

What do I get from the wizard?

  1. We get two XML files for layout. First XML file is for the inner fragment, which contains the default “Hello World” message (as described earlier). Second XML file is the encompassing activity level XML file. If we need to make any changes to the layout, we have to make changes to the fragment file, as the fragment is going to be the default view container.
  2. We get one .java file, which overrides the ActionBarActivity instead of Activity, as was the case earlier. With version 4.x and above, the menu which used to be available at the bottom of the UI screen on demand, can also be made available at the top of the app screen, to make available there, we use ActionBar Activity.
    1. The Java class also provides readymade code to integrate the fragment implementation so that it can integrate with the activity class lifecycle methods.
    protected void onCreate(Bundle savedInstanceState) {
        if (savedInstanceState == null) {
                    .add(, new PlaceholderFragment()).commit();

It also embeds one more class within the code to manage the fragment related activities.

    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {

        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container,
            return rootView;

The PlaceHolderFragment class instantiates the fragment and makes it available for display.

3. We also get the strings.xml file containing the string values for i18n.

 What do I need to do to make it execute?

As in previous case, we will have to do nothing, as the wizard has provided us with everything that we need to execute. If you are uncomfortable with fragments and wish to make use of this same .java file to implement the activity, you can do so by implementing a short cut.

Change the extension of the code from ActionBarActivity to Activity, which will lead to errors being displayed in the code. Simply comment out the code that tries to instantiate the fragment, and the code will run as good old activity class.

What will be required to create an app?

The wizard gives you the basic layout of the activity, you will have to populate the fragment with the additional components as the requirements dictate, and then the components can be instantiated in the .java file and start using it.

Where to use it?

When we are trying to build an application for devices sporting API level 11 and above, it is recommended that we should be using fragments, as it is highly possibly that the application may also be utilised on a tablet. Further, for building any application for a tablet, you should use an activity with a fragment.

My Recommendation:

Personally, I feel this activity type should be used as a basic building block for any activity (model devices), as it provides default implementation for fragments and we can simply customise it build our own application.

Closing Remark:

I had thought, I would explain all the activity types in a single post, but looking at the size it does not seem to be possible, hence I will break it up into multiple parts and try to post them every alternate day from today.

Next post: Empty Activity, Full Screen Activity and Login Activity.

Building an Android Application (Without Errors) – First Application

Last post, we had seen how to set up the environment, in the same sequence we will see how to build the first application, and what can be the possible pitfalls associated with it.

The Assumption here is that you have been able to set up the environment. If you are not sure, you can visit my last post available here.

With that out of the way, let’s start working on building the first application. I understand that people frequent the blogs to find solutions rather than reading endless lines of theory. Hence, we are going to proceed directly with hands-on implementation and then talk of the concept if required.

The firs thing to do is start Eclipse, obviously. Once you have chosen the workspace and the screen is loaded, let’s check if the installations are done correctly.

Select File-> New. It should display options of choosing new artifacts.

Sorry, no images available

Android Wizard

This can also be achieved by right clicking in the package explorer view. I personally, use the right click, but either way is fine. Sometimes, you may not see the option to create a new Android Project immediately, in which case you can choose Other at the bottom of the sub menu.

Clicking on Other option in the menu

Clicking on Other option in the menu

Once you click on this option, you will get the next screen, which allows you to choose whichever project that can possibly be created with your instance of Eclipse.

Other Options available.

Other Options available.

Selecting the Android Application Project will start the wizard in motion and we are on our way to create a new Android application.

Choose a name

Choose a name

Let’s take a look at what values are expected in each of the options.

1. Any virtual name is fine, as it reflects the name of your application. Point to be noted: This name will be used by default in the Google Play Store, if we decide to publish this application. Choose wisely and with discretion. Be creative, choose a name that the users will connect with and be attracted by. It should also say what it is going to do. For example: Hello World. Reminder Service or BookMyShow etc.

2. Project name is meant for Eclipse and typically is same as the application name, but it is not mandatory. It can be any name so long as it is not duplicated in the same workspace.

3. There are multiple schools of thought on what should be the ideal package name, but I follow the thought where you provide the name of your website in reverse order and then add the unique application name. for example, com.phoenix.Reminder or org.apache.struts etc. etc.

Now we tackle the fun part:

4. We will be building an application that we wish to be available to the latest version of the software, but we need to remember that not all the world work on latest, hence we NEED to provide backward compatibility. This option specifies the lowest version that will be supported by your application. Typically, if we see the Google app market, we see that about 15-20% of apps are still running with Gingerbread (version 2.3.3 to 2.3.7)  and less than 1% are on Froyo (version 2.2).

Android SDK version Current market share Change in the last 30 days
4.1-4.3 (Jelly Bean) 60.1 %   No change
4.4 (KitKat) 17.0 %   18%
2.3 (Gingerbread) 11.5 %   7%
4.0.x (ICS) 10.4 %   7%
2.2 (Froyo) 0.7 %   8%
3.0-3.2 (Honeycomb) 0.2 %   10%
2.0-2.1 (Eclair) 0.2 %   16%


Based on this we take a call that the minimum version that we support will be Gingerbread (2.3.3).

5. We generally wish to target our application to work on the latest devices, hence we will keep this option at the highest possible (in our case it would be version 4.4 codename KitKat).

6. Now this is a tricky one. Normally Target SDK and Compilation SDK are same, but they can be different. Which SDK should the compiler map your code against for checking code correctness is defined by this option. This can be the the API that supports all the features that you are going to be using in the application. Hence, may not be same as Target SDK. My suggestion, keep it same as the Target SDK.

7. Theme is used for beautifying the application. There are readymade themes / templates available, choose whichever suits your fancy. I go with default value.

Possible problems:

It is a pretty straight forward screen, hence nothing much go wrong against, but the choices that we make here have repercussions through out the application development life-cycle.

Sometimes, in the zeal of creating new / latest, we may end up putting the minimum SDK required at a higher level, but at the time of beta-testing, the customer may come up with non-compatibility issue.

Let’s move on by clicking on Next.

Customizing the application

Customizing the application

1. This option will allow you to create a custom icon, which will be acting as a launcher (the icon visible on Mobile screen) icon. We’ll see this in next step.

2. Turning this option on instructs the wizard to create a blank activity which can be used immediately. Recommended to keep this on initially, as you will not have to worry about the configuration settings etc.

3. Straight forward option to specify whether the project is going to be an application or an application helper (a library) that can be used in other applications.

4. Any project that we create in Eclipse is added to the current workspace (the one that we chose while starting Eclipse). If you wish you can change the folder by turning the option off and browsing to the folder where you wish to store the application.

5. This is an option that not many people use. I doubt if many people understand what this is all about. Let me try to explain in as less space as possible.

Think of Working Sets as filters.You can choose to add the project, file, resource into a specific working set and then later you can choose which working set you want to work with. A specific working set will allow only those components which are part of it to be displayed and be worked upon.

Possible pitfalls:

There’s not much that can go wrong here. Sometimes, very very very rarely (think 1 in in million) it may happen that even after choosing to create an activity, the wizard does not create it. In this case, you will have to create an activity manually (we’ll talk about this at a later date).

Click Next.

Launcher Icon

Launcher Icon

As the image portrays, this steps will allow us to customize the launcher icon for our application. I personally recommend not bothering with this step, as there are not many options available, and if you want to create a really professional looking application, you are better off getting done by a graphic designer.

This screen can also be avoided by turning the option off in earlier step.

Next up customizing activity

Activity screen types

Activity screen types

There are different types of activities based on the type of UI that is available. We will have a separate discussion on these types of activities. For now, let’s just go with the default Blank activity.

There are no possible pitfalls here. So, let’s just go to the next step.

Classes creation

Classes creation

This screen accepts the name of the Activity name, the layout file which is going to be required and the fragment name.

Along with this, you can also specify the navigational flow of the app. Currently, we will keep everything as it is and go ahead. This is the last step of the wizard After this you will have the first application ready.

Next thing that we are going to do is, select the project, right click on it and say run as -> “Android Application”.

Hello World App screen

Hello World App screen

This is how your first application is going to look like.

Next post, we will talk about the surrounding peripherals that help create the first application in the following sequence.

1. Activity & navigation Types

2.API Levels and their features

3. Android Themes

4. Execution process

5. Android configuration.

Till then….


Building an Android application (without errors) – Setup

As mentioned during last post, Mobile computing is here to stay, and looking at the market numbers we can safely bet that Android is going to rule the roost for years to come. Unless, Google makes a massive blunder or other players come with something really innovative, I don’t see any change in a status quo. And anything is possible.

I am going to share my thoughts about creating Android application, though I do not promise a series, we all know what happened to the last series I promised.I’ll try to create a realistic application that will cater to real life scenario rather than some hypothetical ones.

To start off, I am going to connect with members of the audience who wish to start working On Android, but not sure how to go about it.

Setting up the Infrastructure:

First of all we will be downloading Eclipse, as that is the IDE of choice. You can download the latest version of Eclipse (Luna / 4.4) from here. You can also opt for working with Android Studio, which is provided by Google, we will keep that discussion for a later date and time. Still, if you are interested, you can download it from here.

I personally recommend downloading the Eclipse for JavaEE developers, as we will also be creating a web application to connect with Android. You can choose the option highlighted in the image below.

Sorry, No image available

Eclipse options


Once the download is complete (You will get a zip file), you can unzip the file and start using Eclipse. There are pre-requisites to working with Eclipse. First and foremost, you need to have Java installed and path (environment variable) set to the bin folder of Java installation. Failing to do so will result in an error while starting Eclipse.

Java not available

Java not available

If you see an error message flashing as highlighted when you try to start eclipse, then the solution is very simple. You need to install Java 6, which is available here. If you have already installed Java, then your environment variable “path” is not set set to the Java/bin folder.




Setting Java Path:

Set your Java Path

Set your Java Path

Go into System Properties -> Advanced Settings -> Environment Variables. Select Path variable, if it already exists, otherwise create a new variable.

Set the value of this variable to the “bin” folder, which will allow Eclipse to start.

Please remember that to make this change, you will need to have local administration rights on Windows to make the change. Similarly, you will need to be admin on Unix-close OS for the change.

At this point you will have your Eclipse in a working order. Now let’s turn our attention to getting Android.

Getting Android SDK is as easy as Java downloads, you just need to go to the page. You need to download this SDK, unzip it. Next step would be to download the plug-in for Android, which will allow your Android SDK to connect with Eclipse. This step is necessary for the Eclipse to link up with Android.

Alternatively, Google provides an option, wherein you can download the entire requirements, in terms of the Eclipse IDE, the SDK and the ADT plug-in as a single bundle. You can download it here.

Installing this will ensure your setup is ready to go. To ensure whether the installation is done properly or not, visit the folder where you have unzipped the ADT bundle.

Sorry, no image available

Android Directory Structure




You should be able to see the directory structure for Android, and two executables, AVD Manager and SDK Manager. We will talk about these files later.

Next post, we will talk about starting with the First Android application and the problems which you may encounter while building the first application.

Visit to discover Indian blogs

Mobile Applications: Charting Personal Computing

Over the last few decades we have seen the focus of application development shift from Mainframe and Mini computers to personal computers. While in isolation it can be explained away as advances in technology. The chips became smaller and powerful etc etc.

In reality, the drive towards miniaturization of the Hardware can also be looked at from the end-user perspective. Earlier days the applications were created to solve some big problems which the end-user may or may not be interested in. Applications did not have a far reaching consequence on the lives of layperson.

Over time, the common man started becoming more curious and then intelligent about the computer processes. This resulted in application getting designed to cater to the people in the streets. It was then just a matter of time before the user started demanding understanding of the process. I believe this demand was what drove the invention of Personal computers.

With the help of personal computers, end-user started to solve his / her own personal problems, without depending on some sage (read technical guru) telling him / her to tell them what is good for them. Recollect Personal applications like Word / Lotus which made life easier. Moving ahead a typical layperson started performing his task on his own, for which earlier he used to be dependent. Tasks like tax computing were made easier by applications like Excel.

It is said that the only thing differentiating humans from other animals is the single trait of curiosity. It drives us to go beyond what is available. Similar, Personal computing is the norm now. what next?

Nowhere is the adage “Man is a social animal” proven more effectively than in the virtual world. We NEED to connect with people and share the thoughts that we have. Sometimes, we also need to give our piece of mind to someone. Internet made this possible through the social applications like Twitter, Facebook and such.

All of us have heard of “internet trolls”, whose only job is to criticize and abuse people on the net. We also have an image of such trolls in our minds. Nerdy-types hunched over a keyboard infront of a computer screen looking through large glasses.

Speaking positively, we also know of examples where people did a lot of things on the internet as well. We can do almost everything in our daily life such as banking, paying insurance premium, ordering groceries or takeaway food or even sending gifts. We just log onto the site, enter some data and voila: It’s done.

Today, we have put personal computing using the desktop / laptop machine behind, as we enter into the age of social computing.We want to be connected to our network continually regardless of where we are or what we are doing. Rather we want to share what we are doing to our friends. We used to do that earlier through the desktops, but we do not and cannot carry them with us everywhere.

Enter, personal devices or mobile devices. We can carry the devices in backpockets and whip them out at a moment’s notice. What if, I wanted to share my thoughts with my friends right here right now. No worries, mobile devices can do that.

In addition, there were certain restrictions applied when we used to work with the desktop machines, such as we could not work with locations, or we had to have special arrangements made to work with sensors such as luminance measure, barometer, thermometer and such. Mobile devices have them in built and we can carry them around.

As we take a look back from today towards the past, we see the the curiosity and desire of humans to move beyond the known has been driving the computing from a musty room in some university to the real world beyond academia. Mobile computing is here to stay and it will stay as long as humans are afflicted with wanderlust.

Why not make the most of it and create some beautiful applications for it.

Java 8 What’s new series – Milestone 4

Milestone 4 was released on 13th September 2012 with build 56. There are just two JEPs integrated with this build, so this is going to be a rather short post.

Two JEPs integrated in M4:

JEP 112: Charset Implementation Improvements

JEP 129: NSA Suite B Cryptographic Algorithm

1. JEP 112

This JEP is actually a carry forward from the previous iteration (Java 7) and as such does not have a lot of heavy lifting to do. What it basically does is to provide better performance by reducing the size of the charsets. It also provides better maintenance feature by providing a possibility of generating the necessary charsets at application building. This is achieved by mapping the charsets with simple text based maps.

Possible Impact:

Not much, an application’s rendering of custom charsets will possibly be faster due to reduction in the charset sizes. As this is part of core-lib section. It comes bundled with the JDK and the developer will not have to do anything explicit to implement it and hence, life does not change too much.

2. JEP 129

From a lay programmer’s point of view JEP 129 does not offer any chance of improvements at all. Please remember from the point of view of a standard, non-elite Java programmer’s point of view only.

JEP 129 aims to provide default implementation for cryptographic algorithm released by National Institute of Standards and Technology (NIST). The only purpose of this release, also known as Suite B, is to ensure that the Java applications using these algorithms become eligible for security standard described for United States government. In other words, if your application has been created using the proposed JEP 129, it stands a better chance of being accepted by the US government, financial institutes, and such eminent organization, that needs to take its security a tad more than a lay programmer can provide.

Most of the algorithms proscribed NIST are already part of the standard Java in existence today, through the various JCA providers. Some which are SunEC (ECDSA signature), SUN (SHA 256, SHA 384), SunJCE (AES ciphers) and SunPKCS11 (various implementations).

Possible Impact:

For a typical Java developer, zilch. No impact at all, unless you are responsible for creating an application that is going to be used by high powered organizations such as US of A government etc.

That’s it for this post, as we cover Java 8 M4. There are in all 55 JEPs spread over 7 milestones. We have covered 4 milestones and a grand total of 6 JEPs. This of course means that the succeeding posts are going to be covering a lot of JEPs, 49 to be precise. I am going to split the next three milestones in multiple parts so as not to overload the technology senses.

On a side note, to give myself time to prepare, I am going to take a short break from the Java 8 new feature series and upload a post on something different. Something that will explore a point at implementation level details. I am thinking maybe JDBC 4.2 (which incidentally is part of Java 8 new features, but hey…. )

So long for now, in couple of days a new post on something new.

Java 8 What’s New Series – Milestone 2 and 3

Third post in the Java 8 series. I had planned on focusing on Milestone 2 and describing it, but hard as I try, I couldn’t find any concrete detail on the second milestone. There are no specific JEPs targeted with this milestone, so let’s move on and talk about milestone 3 and explore the three features integrated in M3.

Java 8 Milestone 2 – released on 14th June 2012 with build 43.

Java 8 Milestone 3 – release on 2nd August 2012 with build 50.

The JEPs integrated in M3:

JEP 124: Enhance the certification revocation – checking API

JEP 130: SHA – 224 Message Digests

JEP 131: PKCS#11 Crypto Provider for 64-bit Windows

All three JEPs are part of the enhancements in Java security domain, presumably following the persistent aspersions being cast on security vulnerabilities prevalent in earlier versions of Java.

We will take a look at each JEP and try to understand how it impact our daily development efforts.

1. JEP 124

This JEP focuses on improving the Certification revoking API. These APIs are part of Java Cryptography Architecture (JCA), available through package.

Typically, a developer uses the certification revocation API to check the status of the certificate associated with the process, and decide whether it is valid or to be discarded. Prior to the proposed change, the default API picks up the certificate from the Certificate Revocation Lists (CRLs) or Online Certificate Status Protocol (OCSP) and check for its validity and decide whether the certificate is revoked.

Currently, if the code checking the certification validity cannot access the server on which the certificates are maintained, it is considered to be equivalent to the certificate being revoked, which is not equal to the certificate being revoked. Connectivity is also influenced by external factors on which the application may not have any control.

The new proposal allows for striking a balance between the strictness of assertive certification checking and making allowances for uncontrollable circumstances. This has been called in Java 8 as “best-effort check” for certification revocation.

2. JEP 130

This JEP allows for implementation of SHA-224 variant for Cryptography algorithms. The primary driver for this updates is a simple fact. SHA-1 suffers from a fatal flaw (collision search attack), which renders it unusable for creating highly secure Java applications. Lots of applications and protocols are shifting away from SHA-1 and adopting security algorithms available in SHA-2 family.

It also provides interoperability between various security algorithm providers and the providers provided through standard JDK bundle. So far, JDK did not implement SHA-224, as it was not accepted by common industry users, as were the other variants like SHA-256, SHA-512. Newer implementations of PKCS11 have started implementing SHA-224, hence Java 8 also proposes to provide SHA-224 implementations as part of standard JDK.

Possible impact:

This proposal will allow developers to move away from possible ramifications of using SHA-1 and use comparatively superior algorithm using SHA-224.

3. JEP 131

Windows users are opting for 64-bit OS in larger numbers, and hence Java 8 proposes to provide SunPKCS11 provider as part of standard bundle of JDK. This bundle is not enabled by default, but the developer will have to configure usage of this provider through a configuration file that will list the path to the provider.

Possible impact:

This is just an additional feature that is provided to have 64-bit alternate implementation for default Public Key Cryptography Standard (PKCS). This proposal, if accepted will not change the life of a developer too drastically.

Next post we will take a look at Milestone 4 and continue the journey further. Your comments and suggestions will help me channelize and stay on course.

Java 8 What’s New Series – Milestone 1

As promised, we kick off with a small addition.

Java 8 Milestone 1 released on 26th April 2012 with build 34. feature integrated in this milestone was restricted to a single JEP (JDK Enhancement Proposals) numbered 117. More on what’s a JEP at a later date.

JEP 117: permanent Removal of annotation processing tool(apt) from JDK

First of all, let’s see in brief what exactly is apt, and then we will see why it was a candidate for removal.

apt is a command line utility that is used to replace the existing annotations in the source code and generating new source and other required files. One benefit of using apt is that it can work on recursive discovery mechanism. Let’s try to understand this by looking at how apt works.

apt works on multiple rounds. Developer provides the name of source file that needs to be scanned for annotations. First round of apt searches for and discovers the annotations present in the source and the proceeds to find the annotation processors associated with these and generates new source files. Second round of apt takes the files generated in the first round as input and performs the same search and discover operation on these files and generates new files if annotations exist. So on and so forth it continues till there are no annotations left for processing. At this point the last round initiates, where it picks all the source files generated so far and compiles them using the standard javac command. The execution of this round can be controlled by an option associated with apt -nocompile.

Why does it have to be removed?

Just for the record, let’s understand one thing before the discuss the removal of apt. There is nothing wrong with apt, it is fine. The only reason apt became a candidate for removal, is because Oracle wants to move the annotation processing to the JSR 269. You can refer to the JSR at

apt was introduced in Java SE 5, along with the introduction of annotations, and as a result is based heavily on jdk 1.5. The problem is that it’s just one tool and does not have the pluggability or adaptability of providing support to the feature changes introduced after jdk 1.5.

What JSR 269 offers on the other hand is a pluggable API that can be used by anyone to create an independent annotation processing tool of his / her own and use it along with javac to process the annotations. This helps the developers create flexible tools that have the ability to change and adapt with the corresponding changes in the jdk.

So as a programmer how am I going to be impacted:

If you are heavily using annotations with apt, there is not much that needs to be done. JSR 269 has been integrated with Java SE 6 and nothing extra needs to be done by the developers. Your processing will now have to follow the JSR 269. Practically there is not much of a problem, except if you have got some code in Jax-WS (older versions), in which case you might have to take a new look at the code and modify to support JSR 269.


Next post we take a look at MileStone 2, which did not have any feature integrated within it, but made improvements across the board.

Whither Java?

Oracle had planned to release a feature-complete Java 8 Milestone 6 in the month of January, but ultimately they ended up releasing M6 with few slippages and announced the initiation of M7, which was released as the feature complete release in the month of June (build 94). Well, we can say almost feature complete, as there still are a few features that need to be closed down, and these will be closed in M8. 

Work is now on for building the Developer preview M8 to be closed on 21st November 2013. Will it or based on the history of mishaps we can safely say that Oracle will slip the deadline. Again. All the problems that Oracle seems to be facing are arrayed around the inclusion of Project Lambda, which seems to be taking a lot of time. Mark Reinhold, owner of Java (in this iteration) at Oracle has also suggested that the project will require more time to complete.

Project JigSaw has already bitten the dust, and will not be integrated with JDK 8, but instead will ship with Java 9, as per Mark Reinhold on his blog @ JigSaw was sacrificed to make way for Lambda. Is it really worth it? We don’t know yet, once the feature complete Developer Preview becomes available, we will be able to say, whether Lambda makes a developer life easier or it would have been better to have pushed for JigSaw. We will have a comparative discussion at that point of time.

So, as we wait for the Final – final version of Feature complete JDK to release let’s try to have an understanding of what is new with JDK, based on the Milestones already completed.

  1. M1
  2. M2
  3. M3
  4. M4
  5. M5
  6. M6 (Originally Feature Complete)
  7. M7 (New Feature Complete)
  8. M8 (Actual Feature Complete)
  9. M9 Final Release Candidate
  10. GA General Availability

We will take a look at each Milestone separately in subsequent posts and try to see what was added in each milestones and how it affects me as a Java Professional.