-
If statement with String comparison fails
== tests for reference equality. .equals() tests for value equality. == is for testing whether two strings are the same object. Comparison symbols is only can use by local variable only. Public Variable should use "equals" to compare. Java @Kroll.method public void ComparisonTest(String value) { String operation = value; String operation_local…
-
Java can't Use Switch on a String?
In Java JRE 1.7 below switch is not allow to use String for input case. Only JRE1.7 Above can be use String in the Switch. *Note Titanium workspace compiler compliance default is 1.6 need manual change this inside by Set workspace compiler compliance settings to 1.7…
-
Java Check Input integer
Java @Kroll.method public String InputCheck(String value1 , String value2) { String inputType= ""; String [] numbers = {value1, value2}; for(String x : numbers ) { try{ int checkInput = Integer.parseInt(x); inputType = "Number"; }catch (NumberFormatException ex) { //handle exception here inputType = "No Number!"; break; } } if(inputType == "Number"){ int Intvalue1 = Integer.parseInt(value1); int Intvalue2 = Integer.parseInt(…
-
Titanium Android Module
a Simple Prototype for Create Titanium Android Native Module. In this Prototype I will create a Titanium Android Native Module calling "testmodule" And Create Four simple Maths calculation Java /** * This file was auto-generated by the Titanium Module SDK helper for Android * Appcelerator Titanium Mobile * Copyright (c) 2009-2010 by Appcelerator, Inc.…