I have a problem processing messages in a stream. My run method looks like this:
public void run() {
Looper.prepareLooper();
parserHandler = new Handler {
public void handleMessage(Message msg) {
Log.i("","id from message: "+msg.getData.getString("id"));
this.wait();
}
}
}
I have several Shares sending messages to this stream, for example:
Message parserMessage = new Message();
Bundle data = new Bundle();
data.putString("id", realId);
data.putString("callingClass", "CategoryList");
parserMessage.setData(data);
parserMessage.what = PARSE_CATEGORIES_OR_PRODUCTS;
parserHandler = parser.getParserHandler();
synchronized (parserHandler) {
parserHandler.notify();
Log.i("","message ID: " + parserMessage.getData().getString("id"));
}
parserHandler.sendMessage(parserMessage);
The problem is that the run-method log records "id from message: null", although "message ID" has a value in the Log-statement. Why does the message "lose" data when sent to the stream? How does this relate to the notification? Thank you for your help.
source
share