October 19, 2016

WindowManager: android.view.WindowLeaked: Activity has leaked window

While developing an android mobile app, I received this error.
In the mobile app, on click of back button, a dialog will be opened with few buttons including "Exit". On click of exit, I have given (Activity context).finish(); but it is throwing the below error.

WindowManager: android.view.WindowLeaked: Activity <app package> has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{45500950 V.E..... R....... 0,0-640,929} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:252)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:286)
at android.app.Activity.onKeyUp(Activity.java:2204)
at android.view.KeyEvent.dispatch(KeyEvent.java:2664)
at android.app.Activity.dispatchKeyEvent(Activity.java:2434)

This error occurred due to improper closing of the dialog box before exiting the app. So, the solution I found is to dismiss the dialog box before calling finish() method.

September 5, 2016

Social All In One - One app solution for all your social network activities

I have developed another android app named as "Social All In One" which is a one app solution for all your social activities. No need to install each app like Facebook, Twitter, Linkedin, Pinterest and Instagram etc. This app supports all popular social networking sites.

It will become the primary Social Hub on your phone.

This app supports social networks including Facebook, Twitter, Linkedin, Google+, Instagram, Badoo, Disqus, Flickr, My life, Hi5, Reddit, Vine, VK, Wayn, xing, We heart it, Livejournal, My heritage and more.

Click here for more details.

July 28, 2016

Reverse 2048

Reverse 2048  - A new android app from me.

This is a fun, addictive and a puzzle board game. It is a cool variant of traditional 2048 puzzle game.

The challenge is to reach from the #2048 tile to #1 tile. When tile with number 1 is created, the player wins the game.

Click here for more details of the app.

June 28, 2016

How to invoke HTTP methods like PUT,PATCH and DELETE using HttpURLConnection

     I am invoking REST web services using HttpURLConnection. Few of the rest services have operations like PUT, PATCH, and DELETE. While passing these methods in setRequestMethod() of HttpURLConnection object, I am getting the below error in response.

java.net.ProtocolException: Invalid HTTP method: PATCH

     To avoid this error and to let the HttpURLConnection execute these methods, there is a workaround which is to override the http method we are invoking. And the procedure to do it is,
  • Invoke any accepted http method like GET or POST
  • Pass the new method value to the header parameter "X-HTTP-Method-Override" to Override the method 
Below is the example: 
            URL url = new URL(mcsPatchAPIURL);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty("Accept", "application/json");
            conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
            conn.setRequestProperty("X-HTTP-Method-Override", "PATCH");

To get an idea about these methods:

GET: To get the details of a resource
PUT: To update the existing resource
POST: To create a new resource
PATCH: To update the existing resource partially
DELETE: To delete the existing resource

May 13, 2016

Cordova Plugin is not added to MAF

I faced an issue where I could not able to add few cordova plugins to Oracle MAF application. I could able to select the plugin but after selected, it is not added to MAF and not showing any error also.

Check the value of the attribute xmlns of the tag plugin in the plugin.xml file under the corddova plugin folder. Generally it is


Change the value to as below

Now re-try to add the plugin to MAF.