Arun, I am not sure what is the purpose of going to sleep mode, and secondly you put a logs on the other abstract methods of your activity class. I would suggest read the Android life cycle as well.
Warm Regards, *Mukesh Kumar*, Android Consultant/Freelancer, India,Hyderabad. On Mon, Dec 26, 2011 at 4:04 PM, B.Arunkumar <awsnetworkrecor...@gmail.com>wrote: > Hi, > > I have a problem with button click. This is what I have written in a > sample Activity: > > button1 = (Button) findViewById (R.id.button1); > button2 = (Button) findViewById (R.id.button2); > > button1.setOnClickListener(new OnClickListener(){ > > @Override > public void onClick(View v) { > // TODO Auto-generated method stub > try { > android.util.Log.e("Button1", > "clicked"); > Thread.sleep(15000); > } catch (InterruptedException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > }); > > button2.setOnClickListener(new OnClickListener(){ > > @Override > public void onClick(View v) { > // TODO Auto-generated method stub > > try { > android.util.Log.e("Button2", > "clicked"); > Thread.sleep(15000); > } catch (InterruptedException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > }); > > This is what happens (We tested the application on Samsung Galaxy). > When we click on Button1 and then Button2 and button1 again, we see > that both button1 and button2 have changed theiir color to blue > simultaneously. Why is that the color of both the buttons change > simultaneously? As per this link: > > http://android-developers.blogspot.com/2009/05/painless-threading.html > > the button click event happens on the same main UI thread. In that > sense, both the buttons should not have changed their colors > simultaneously. > > Thank you, > B.Arunkumar > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en