June 27, 2015

InAppBrowser in Oracle MAF using Cordova plug-in

This post is to show how to implement In-app browser in MAF using Cordova plugin.

If you have a url in the app, on click of the url, the URL will be open in a browser but if you want to come back to the app, you have to open your app tray and select the app. If you implement in-app browser, the url will be opened in a custom browser in the app itself, and you can see a button like "Done" on the browser. On click of that, you can return to the app.

Below is the procedure to develop the in-app browser using Cordova plugin.
  • Download the zip file of the project from Github and unzip it
  • Create a folder with the name plugins in ViewController project in the app
  • Copy file plugin.xml and folders www, src from the above Github project to the plugins folder
  • Open maf-application.xml file and select Plugins 
  • Under "Additional Plugins", add the plug in. See below screen for your reference

  • Write the below code in a java method and assign that method as an action or action listener to an action component in your page
          String urlToPen = "http://myfusionlearnings.blogspot.com";
        'location=no,toolbarposition=top,clearcache=yes');}", new Object[] {});

June 24, 2015

Word Type Count

"Word Type Count" is a tool developed in Java, useful to count number of occurrences of each word in the given String. It also counts the total number of words in the given string. The tool would look like as below. 
Download the java program from here.

For example, in the above screen, we could see the input string "This is to count number of occurrences of each word in a given String". When the button "Count Words" is pressed, it will display the result in the output text box as shown in the screen in which we could see each word of the given input string and count of their occurrences. And also we could see at the end of the result, the total count (shown with the word "Size") of words in the input string. 

June 19, 2015

Java program to create Zip files

In this post, I wanted to show how to create a zip file using a java program.
In this example, input to the program is test.html and out put would be outFile.zip which contains the given test.html.

The same program can be downloaded from here.