A message sends an object, but the properties of the object are null

My multithreaded application sends messages between threads. I am sending a message using this method

public static void sendToListener(SomeObject someobject, Object obj) {

    Message msg = new Message();
    msg.setTarget(ResponseClass.responseMessageHandler);
    Vector<Object> v = new Vector<Object>();
    v.add(someobject);
    v.add(obj);
    msg.obj = v;
    msg.arg1 = someobject.id;
        Log.d(TAG,someobject.str); // property named str is not null
    msg.sendToTarget();
}

and I get with;

public static Handler responseMessageHandler = new Handler(){
    @Override
    public void handleMessage(Message msg) {
        Vector<Object> v = (Vector<Object>) msg.obj;
        SomeObject so = (SomeObject) v.elementAt(0);
        Object o = v.elementAt(1);
        Log.d(TAG,so.str); // property named str is null
    }
};

If I send a message with an object, the object is sent without problems, but the String properties of the object are sent as null. All primitive typed properties are true, such as booleans and integers.

+3
source share

All Articles