Advertisement
Guest User

CIQ-getProperty-test

a guest
Feb 7th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. function getProperty(key) {
  2.     var result = Application.getApp().getProperty(key);
  3.  
  4.     // comment out the following code when finished debugging
  5.     System.println("getProperty(" + key + ") = " + result);
  6.     if (result == null) {
  7.         System.println("  property is null");
  8.     } else if (result instanceof Number) {
  9.         System.println("  property type is Number");
  10.     } else if (result instanceof Long) {
  11.         System.println("  property type is Long");
  12.     } else if (result instanceof Float) {
  13.         System.println("  property type is Float");
  14.     } else if (result instanceof Double) {
  15.         System.println("  property type is Double");
  16.     } else if (result instanceof String) {
  17.         System.println("  property type is String");
  18.     } else {
  19.         System.println("  property type is some other type")
  20.     }
  21.     return result;
  22. }
  23.  
  24. // ...
  25. // This code should be in a function that's called in both
  26. // initialize() and onDeviceSettingsChanged()
  27. LastTimeMinute = getProperty("LastTimeMinute");
  28. LastTimeHour = getProperty("LastTimeHour");
  29. PacerSpeed = getProperty("PacerSpeed");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement