Thursday, 11 October 2018

Kony Date Picker Example


Kony Visualizer 8.2.0

Date Picker ;

function datePickerEvent(){
  try{
    var dateVal = frmExampleCalendarwidgets.calFirstBtn.dateComponents;
    alert("Resonse : "+JSON.stringify(dateVal));
    alert("Day : "+dateVal[0]);
    alert("Month : "+dateVal[1]);
    alert("Year : "+dateVal[2]);
  }catch(err){
    kony.print("Error"+JSON.stringify(err) );
  }
}

Wednesday, 10 October 2018

Kony Switch Button ON and OFF

var gblSwitchbtnOnOff = true;

function eventAnimationSwitch(){
  try{
    if(gblSwitchbtnOnOff ){
      frmSwitchExp.Button0dccd5815ed3e49.animate(
        kony.ui.createAnimation({
          "100": {
            "left": "36dp",
            "stepConfig": {
              "timingFunction": kony.anim.EASE
            }
          }
        }), {
          "delay": 0,
          "iterationCount": 1,
          "fillMode": kony.anim.FILL_MODE_FORWARDS,
          "duration": 0.25
        }, {
          "animationEnd": afterEnd
        });

    }else{
      frmSwitchExp.Button0dccd5815ed3e49.animate(
        kony.ui.createAnimation({
          "100": {
            "left": "1dp",
            "stepConfig": {
              "timingFunction": kony.anim.EASE
            }
          }
        }), {
          "delay": 0,
          "iterationCount": 1,
          "fillMode": kony.anim.FILL_MODE_FORWARDS,
          "duration": 0.25
        }, {
          "animationEnd": afterEnd
        });
    }

  }catch(err){
    alert("Error "+JSON.stringify(err));
    kony.print("Error "+JSON.stringify(err));
  }
}


//After complete Animation change the status
function afterEnd(){
  if(gblSwitchbtnOnOff){
    gblSwitchbtnOnOff = false;
    frmSwitchExp.Button0dccd5815ed3e49.skin = "btnSkinGreen";
  }else{
    gblSwitchbtnOnOff = true;
    frmSwitchExp.Button0dccd5815ed3e49.skin = "btnSkinGray";
  }
}

Kony Android Native FFI

library might be using APIs not available in 14

as the library might be using APIs not available in 14
[exec-shell] \tSuggestion: use a compatible library with a minSdk of at most 14,
[exec-shell] \t\tor increase this project\'s minSdk version to at least 15,
[exec-shell] \t\tor use tools:overrideLibrary=\"your packagename\" to force usage (may lead to runtime failures)
[exec-shell] 10 actionable tasks: 10 executed



Example code for Custom Widgets in kony FFI


Android Custom Widget Code


LinearLayout linLayout = new LinearLayout(context.getApplicationContext());
// specifying vertical orientationlinLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams leftMarginParams = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
leftMarginParams.leftMargin = 50;

Button btn1 = new Button(context.getApplicationContext());
btn1.setText("Button1");
btn1.setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View view) {

        Toast.makeText(context, "Event Click", Toast.LENGTH_SHORT).show();
    }
});
linLayout.addView(btn1, leftMarginParams);













Tuesday, 9 October 2018

app:transformResourcesWithMergeJavaResForRelease



Execution failed for task ':app:transformResourcesWithMergeJavaResForRelease'.


I found a solution which works in my case.
I deleted the .gradle and .idle folder from the studio and then re-run the app.
it works fine for me

Monday, 1 October 2018

Kony Preprocessor using JavaScript


function exaplePre(){

  var username = serviceInputParams.get("Request Parameter Key Name");
  if(username == "1"){
    serviceInputParams.put("Request Parameter Key Name","Request Parameter Key Value");
  }else if("your condition){
     serviceInputParams.put("Request Parameter Key Name","Request Parameter Key Value");
  }
 
 return true;
}

exaplePre();



Kony PreProcessor using JAVA




package com.konylabs.chandrupreprocessor;

import java.util.HashMap;

import com.konylabs.middleware.common.DataPreProcessor;
import com.konylabs.middleware.controller.DataControllerRequest;
import com.konylabs.middleware.dataobject.Result;

public class ExamplePreProcessor implements DataPreProcessor{

@Override
public boolean execute(HashMap arg0, DataControllerRequest arg1, Result arg2) throws Exception {


String username = new String("" + arg0.get("usernames"));
if (your condition) {


//Modify Parameter Value in request time

      arg0.put("paramer key name", "Parameter Key Value");


}else{

//your respnse result like
}
return true;
}

}











A failure occurred while executing com.android.build.gradle.tasks

Error in Kony visualizer V9 service pack 6 and FX11  [2023-01-09 22:23:32.695] [DEBUG] ~~~~ - INFO [exec-shell] Execution failed for task ...