How to prevent the activity from loading twice on pressing the button

后端 未结 19 1992
情深已故
情深已故 2020-12-01 00:15

I am trying to prevent the activity from loading twice if I press the button twice instantly after the first click.

I have an activity which loads on click of a butt

19条回答
  •  盖世英雄少女心
    2020-12-01 00:38

    You can try this also

    Button game = (Button) findViewById(R.id.games);
            game.setOnClickListener(new View.OnClickListener() 
            {
                public void onClick(View view) 
                {
                    Intent myIntent = new Intent(view.getContext(), Games.class);
                    startActivityForResult(myIntent, 0);
                }
    
            });
    

提交回复
热议问题