The android application is bulit in such a way that when data is being sent(on clicking the button) to the usb device ,LED toggles and the data is being displayed. I want data to be sent continuously without any manual intervention. Kindly help

   if (mInputStream != null)
       {
          int Data = 0;
           try {
             Data = mInputStream.read();
           } catch (IOException e) {
           }
            if (Data == LED_ON)
            {

            ledStatus.setText("LED is ON");             
            }
             else if (Data == LED_OFF)
            {

            ledStatus.setText("LED is OFF");                                
            }
        else
        {
            ledStatus.setText("Request failed");                
        }

            }
           else 
            {
        ledStatus.setText("mInputStream == null");

            }
有帮助吗?

解决方案

this time I have tested it myself... it should definitely work paste it in your onCreate() good luck :)

 Timer t = new Timer();
        t.schedule(new TimerTask(){
              public void run(){
                           // write the method name here. which you want to call continuously
                  Log.d("timer", "timer");
                  }
                  },10, 1000);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top