import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.runtime.*;
import com.google.appinventor.components.common.ComponentCategory;
@DesignerComponent(version = 1.0, description = "This is an extension used to convert one unit to another unit<br><b>Creator: </b>Ruthenium Alpha",
category = ComponentCategory.EXTENSION,
nonVisible = true, iconName = "http://appyBuilder.com/extensions/icons/extension.png")
@SimpleObject(external = true)
public class Number_formatter extends AndroidNonvisibleComponent {
private ComponentContainer container;
public Number_formatter(ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction(description = "Converts a length unit to another length unit")
public String ConvertLengthUnit(String FromUnit, String ToUnit, int Value) {
if (FromUnit == "mm") {
if (ToUnit == "mm") {
return (Value*1);
}
else if (ToUnit == "cm") {
return (Value/10);
}
else if (ToUnit == "m") {
return (Value/1000);
}
else if (ToUnit == "km") {
return (Value/1000000);
}
}
else if (FromUnit == "cm") {
if (ToUnit == "mm") {
return (Value*10);
}
else if (ToUnit == "cm") {
return (Value*1);
}
else if (ToUnit == "m") {
return (Value/100);
}
else if (ToUnit == "km") {
return (Value/100000);
}
}
else if (FromUnit == "m") {
if (ToUnit == "mm") {
return (Value*1000);
}
else if (ToUnit == "cm") {
return (Value*100);
}
else if (ToUnit == "m") {
return (Value*1);
}
else if (ToUnit == "km") {
return (Value/1000);
}
}
else if (FromUnit == "km") {
if (ToUnit == "mm") {
return (Value/1000000);
}
else if (ToUnit == "cm") {
return (Value/100000);
}
else if (ToUnit == "m") {
return (Value/1000);
}
else if (ToUnit == "km") {
return (Value*1);
}
}
}
}
Hi, I am trying to make my first extension which is a unit converter in Code Editor AppyBuilder. When I compiled the aix it says there is an error. But I am not abled to find the problem. Can anyone help.
Thank you.....