I'm currently trying to wrap this view: range-seek-bar - A slider widget for Android allowing to set a minimum and maximum value on a numerical range. - Google Project Hosting .
So far there is the following code to wrap it:
When I'm trying to run this code, I get a RuntimeException: Object should first be initialized. This happens on the line where I call the Initialize function of the RangeSeekBar.
It turned out that the line "super.innerInitialize(ba, EventName, true);" in the Java code is where the exception triggers.
What could be the reason for this?
So far there is the following code to wrap it:
B4X:
package de.smartshopping.rangeseekbar;
import anywheresoftware.b4a.BA;
import de.smartshopping.rangeseekbar.RangeSeekBar.OnRangeSeekBarChangeListener;
import java.lang.Number;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.objects.ViewWrapper;
@ShortName("RangeSeekBar2")
@Version(1.0f)
@ActivityObject
@DependsOn(values = { "rangeseekbar" })
public class RangeSeekBar2 extends ViewWrapper<RangeSeekBar<Integer>>{
private RangeSeekBar<Integer> rangeseekbar;
private Integer absoluteMinValue;
private Integer absoluteMaxValue;
public void Initialize(final BA ba, String EventName, Integer absoluteMinValue, Integer absoluteMaxValue) {
this.absoluteMinValue = absoluteMinValue;
this.absoluteMaxValue = absoluteMaxValue;
super.Initialize(ba, EventName);
}
@Hide
public void innerInitialize(final BA ba, final String EventName, boolean keepOldObject) {
if (!keepOldObject)
setRangeSeekBar(new RangeSeekBar<Integer>(absoluteMinValue, absoluteMaxValue, ba.context));
super.innerInitialize(ba, EventName, true);
if (ba.subExists(EventName + "_rangeseekbarchange")) {
this.rangeseekbar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
@Override
public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, Integer minValue, Integer maxValue) {
ba.raiseEvent(getRangeSeekBar(), EventName + "_rangeseekbarchange", minValue, maxValue);
}
});
}
}
@Hide
public RangeSeekBar<Integer> getRangeSeekBar() {
return this.rangeseekbar;
}
@Hide
public void setRangeSeekBar(RangeSeekBar<Integer> rangeseekbar) {
this.rangeseekbar = rangeseekbar;
}
public boolean getNotifyWhileDragging(){
return this.rangeseekbar.isNotifyWhileDragging();
}
public void setNotifyWhileDragging(boolean arg0){
this.rangeseekbar.setNotifyWhileDragging(arg0);
}
public Number getAbsoluteMinValue() {
return this.rangeseekbar.getAbsoluteMinValue();
}
public Number getAbsoluteMaxValue() {
return this.rangeseekbar.getAbsoluteMaxValue();
}
public Number getSelectedMinValue() {
return this.rangeseekbar.getSelectedMinValue();
}
public void setSelectedMinValue(Integer arg0){
this.rangeseekbar.setSelectedMinValue(arg0);
}
public Number getSelectedMaxValue() {
return this.rangeseekbar.getSelectedMaxValue();
}
public void setSelectedMaxValue(Integer arg0){
this.rangeseekbar.setSelectedMaxValue(arg0);
}
public void setNormalizedMinValue(double arg0){
this.rangeseekbar.setNormalizedMinValue(arg0);
}
public void setNormalizedMaxValue(double arg0){
this.rangeseekbar.setNormalizedMaxValue(arg0);
}
}
It turned out that the line "super.innerInitialize(ba, EventName, true);" in the Java code is where the exception triggers.
What could be the reason for this?