1. Hot New Devices! HTC One M9 | Samsung Galaxy S6 | LG G4

Delayed instruction?


  1. Anza87

    Anza87 Member

    Hello,

    I need to execute one OutputStream instruction with little delay, because may receiver is to slow for receiving second data...

    Here is the example:

    Code (Text):
    1. toggleButton2.setOnClickListener(new View.OnClickListener() {
    2.                 EditText editText1 = (EditText)findViewById(R.id.editText1);
    3.                 public void onClick(View v) {                
    4.                     if(toggleButton2.isChecked()){
    5.                         try
    6.                         {
    7.                            String t = "2";
    8.                             mmOutputStream.write(t.getBytes());
    9.                             int vrednost = Integer.parseInt(editText1.getText().toString());
    10.                    
    11.                          //here I need delay for example, 100ms!!
    12.                             mmOutputStream.write(vrednost);
    13.                         }
    I wrote comment where I need delay for around 100ms...Is this possible? How can I do that?

    Advertisement

Share This Page