خرید بک لینک

Vote count: 0

as subject says I'm looking for a way to run first if on first click on the button and run next if on click on the button Here is what i tried

final Button button = (Button) findViewById(R.id.welcomeButton);
final TextView textView = (TextView) findViewById(R.id.welcomeText);
button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View p1)
        {

            int x = 1;

            if (x == 1)
            {
                textView.setText(R.string.step1);
                button.setText("Next");

                // heres increment of the variable x so on next click x will be 2 and the next if will be run instead
                x++;
            }
            if (x == 2)
            {
                textView.setText(R.string.step2);
                button.setText("Next");
            }


        }
    });

}

as you can see theres a increment on first if so it increases the variable x and next time that button is clicked x is 2 and second one will run but the problem is on first button click it runs the first if then increase the variable and runs next if . how can i do this in this method ? is it better to use a case if yes please give me an example of it thanks in advance

asked 37 secs ago

برچسب: android ruing slow,android ruing app,android ruing games,android ruing apps list,android ruing out of space,android ruing,android ruing ios,android ruing on iphone,android ruingtaskinfo,android ruing games free download, نویسنده: استخدام کار تاريخ: جمعه 22 مرداد 1395 ساعت: 20:35

صفحه بندی