Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends Activity {
- Button b1,b2;
- int a=0,b=0,ctr=0;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- b1=(Button)findViewById(R.id.button1);
- b2=(Button)findViewById(R.id.button2);
- }
- public void onclick(View V){
- switch(V.getId())
- {
- case R.id.button1:
- {
- if(a==2)
- { try {
- b1.setBackgroundResource(R.drawable.i_1);
- Thread.sleep(5000);
- b5.setVisibility(V.GONE);
- b1.setVisibility(V.GONE);
- } catch (InterruptedException e) {
- //TODO Auto-generated catch block
- e.printStackTrace();
- }
- ctr=0;b=0;
- }
- else
- {
- ctr++;
- b=a;
- a=1;
- if(ctr>=2)
- {
- b1.setBackgroundResource(R.drawable.cd);//created xml file:named cd
- switch(b)
- {
- //stmts
- }b=0;ctr=0;
- }
- }
- break;
- }
Add Comment
Please, Sign In to add comment