I have very simple code for handlers:
Handler seconds=new Handler() { @Override public void handleMessage(Message msg) { bar.incrementProgressBy(5); tView1.setText("r:"+msg); } };
And my thread:
Thread seconds_thread=new Thread(new Runnable() { public void run() { try { for (int i=0;i<20 && isRunning.get();i++) { Thread.sleep(1000); Message m = new Message(); Bundle b = new Bundle(); b.putInt("what", 5);
As you can see above, I'm trying to change the " what " value in the message, so I can do different things based on the message, but according to " tView1.setText("r:"+msg) " the value "" does not change to 5 :( it only shows " what=0 "
How to change Message values so that I can do different things based on the message?
Thanks!
source share