Guest User

Untitled

a guest
Jan 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class MainActivity extends Activity {
  2. Button b1,b2;
  3. int a=0,b=0,ctr=0;
  4. @Override
  5. public void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. setContentView(R.layout.activity_main);
  8. b1=(Button)findViewById(R.id.button1);
  9. b2=(Button)findViewById(R.id.button2);
  10.  
  11. }
  12. public void onclick(View V){
  13.  
  14.  
  15. switch(V.getId())
  16. {
  17. case R.id.button1:
  18. {
  19.  
  20.  
  21. if(a==2)
  22. { try {
  23. b1.setBackgroundResource(R.drawable.i_1);
  24. Thread.sleep(5000);
  25. b5.setVisibility(V.GONE);
  26. b1.setVisibility(V.GONE);
  27. } catch (InterruptedException e) {
  28. //TODO Auto-generated catch block
  29. e.printStackTrace();
  30. }
  31. ctr=0;b=0;
  32. }
  33. else
  34. {
  35. ctr++;
  36.  
  37. b=a;
  38. a=1;
  39. if(ctr>=2)
  40. {
  41. b1.setBackgroundResource(R.drawable.cd);//created xml file:named cd
  42. switch(b)
  43. {
  44. //stmts
  45.  
  46.  
  47.  
  48. }b=0;ctr=0;
  49. }
  50. }
  51. break;
  52. }
Add Comment
Please, Sign In to add comment