Hi there,
I made an extension in Java to store alarm data between different screens in an app. Currently when trying to run the app, the app will crash as soon as I try to get information out of the extension object. I am not sure why this is happening. Here is the extension I created:
package com.google.appinventor.components.runtime;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.common.YaVersion;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import java.lang.NumberFormatException;
import java.util.ArrayList;
@DesignerComponent(version = YaVersion.LABEL_COMPONENT_VERSION,
description = "dummy object for alarm and location data",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/externalComponent.png")
@SimpleObject(external=true)
public final class AlarmLocationObject extends AndroidNonvisibleComponent {
private String alarmName = "";
private String alarmAddress = "";
private String alarmLatitude = "";
private String alarmLongitude = "";
private String alarmHour = "";
private String alarmMinute = "";
/*public AlarmLocationObject(ComponentContainer container) {
* super(container.$form());
}*/
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "name of the alarm")
public void createAlarm(AlarmLocationObject alarm1) {
this.alarmName = alarm1.getAlarmName();
this.alarmAddress = alarm1.getAlarmAddress();
this.alarmLatitude = alarm1.getAlarmLatitude();
this.alarmLongitude = alarm1.getAlarmLongitude();
this.alarmHour = alarm1.getAlarmHour();
this.alarmMinute = alarm1.getAlarmMinute();
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "name of the alarm")
public void setAlarmName(String alarmName) {
this.alarmName = alarmName;
}
@SimpleProperty
public String getAlarmName() {
return alarmName;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "address of the alarm")
public void setAlarmAddress(String alarmAddress) {
this.alarmAddress = alarmAddress;
}
@SimpleProperty
public String getAlarmAddress() {
return alarmAddress;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "location latitude")
public void setAlarmLatitude(String alarmLatitude) {
this.alarmLatitude = alarmLatitude;
}
@SimpleProperty
public String getAlarmLatitude() {
return alarmLatitude;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "location longitude")
public void setAlarmLongitude(String alarmLongitude) {
this.alarmLongitude = alarmLongitude;
}
@SimpleProperty
public String getAlarmLongitude() {
return alarmLongitude;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "alarm hour mark")
public void setAlarmHour(String alarmHour) {
this.alarmHour = alarmHour;
}
@SimpleProperty
public String getAlarmHour() {
return alarmHour;
}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING)
@SimpleProperty(description = "alarm minute mark")
public void setAlarmMinute(String alarmMinute) {
this.alarmMinute = alarmMinute;
}
@SimpleProperty
public String getAlarmMinute() {
return alarmMinute;
}
}