How to set Delay for loop in android?
I am trying to display a multiplication table with delay. My code is working fine but I am not able to implement the delay. Here is My code: tableButton1 = (Button) findViewById(R.id.Button1); tableButton1.setOnClickListener(new OnClickListener() { public void onClick(View v) { new Thread(new Runnable() { public void run() { str = tableButton1.getText().toString(); a = Integer.parseInt(str); StringBuilder sb = new StringBuilder(); for (int i = 1; i <= 10; i++){ sb.append(a + " x " + i + " = " + i * a+ "\n"); } s = String.valueOf(sb); Intent intent=new Intent(getApplicationContext()