•   almost 8 years ago

Why does getObjectID always return -1?

I want to know when the user selects an object like image or text on the canvas.

Note: I am not using setOnSelectChangeListener because that only fires when the object (image or text) has been deselected not selected.

I didn't see any other method exposed by the SDK that directly does this.

So as a workaround, I tried something like this in the onTouchEvent

public boolean onTouchEvent(MotionEvent arg0) {
ObjectType type = getSelectedObjectType();
int id = getObjectID();

switch (type) {
case Image: {
SObjectImage image = (SObjectImage) getSAMMObject(id);
// do something with the image
break;
}
case Text: {
SObjectText text = (SObjectText) getSAMMObject(id);
// do something with the text
break;
}
default:
Log.i("Msg", "no match - id = " + id + ", type = " + type);
}
return super.onTouchEvent(arg0);
}

However, getObectID always returns -1. Is that a bug? Am I approaching the problem correctly?

  • 1 comment

  •   •   almost 8 years ago

    Hi Numan,

    Some of the object manipulation APIs of the SDK are not working yet. My apologies, it's confusing. Those should have been hidden until the implementation is complete. I have passed that as feedback to the development group.

    Best,
    Hod Greeley
    Samsung Developers

Comments are closed.