November 1, 2016

How to open device camera or picture gallery from Oracle MAF app

MAF provides a device feature method getPicture() to open the device camera or picture gallery. You can create binding to it if you want to open camera on the app. But if you want to handle this from java code in MAF, then check the below post.

Below is the code should be used to access the camera from the java code in MAF.

DeviceManager dm = DeviceManagerFactory.getDeviceManager();

This method returns a string value with either base46 encoding string or the file path of the image based on the given destination type.

Syntax of the method is:
getPicture(int quality, int destinationType, int sourceType, boolean allowEdit, int encodingType, int targetWidth, int targetHeight) 


quality: Quality of saved image
destinationType: Type of the return value whether it is base64 encoding string or file path. For base64 use 0=DESTINATIONTYPE_DATA_URL or for file path use 1 = DESTINATIONTYPE_FILE_URI
sourceType: What is the source of the picture whether it is device camera or photo gallery. For gallery use 0=CAMERA_SOURCETYPE_PHOTOLIBRARY or for camera use 1=CAMERA_SOURCETYPE_CAMERA
allowEdit: Allow simple editing of image before selection
encodingType: the encoding of the returned image file. Select 0 = CAMERA_ENCODINGTYPE_JPEG for JPEG image or 1 = CAMERA_ENCODINGTYPE_PNG for PNG image
targetWidth: Width in pixels to scale image
targetHeight: Height in pixels to scale image

Note: you can not test camera in iOS Simulator or Android Emulator. The camera can be tested only on the device, but you can test the gallery in the Simulator or Emulator. To check if the running device is Simulator or Emulator, you have to give a condition like,

if (dm.getName().indexOf("Simulator") != -1)  // For iOS Simulator
if (dm.getName().indexOf("sdk") != -1)            //For Android Emulator

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$DecorView{45500950 V.E..... R....... 0,0-640,929} that was originally added here
at android.view.ViewRootImpl.<init>(
at android.view.WindowManagerGlobal.addView(
at android.view.WindowManagerImpl.addView(
at android.view.KeyEvent.dispatch(

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.