I followed this direction here and added the two USB wrapper the author created (AdkPort and Ringbuffer)

enter image description here

Moving cursor on it says "class" or "interface" expected.

Any idea how to resolve this?

有帮助吗?

解决方案

You are declaring mbed outside a class.

The link you point to shows the following code snippet:

private AdkPort mbed;
...
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
            ...
            mbed = new AdkPort(this);
            Thread thread = new Thread(mbed);
            thread.start();
            mbed.attachOnNew(new AdkPort.MessageNotifier(){ 
        @Override
        public void onNew()
        {
            byte[] in = mbed.readB();
                            // Do something with the data
                    }
            });
            ...
   }

What may not be evident to you is that, in the above snippet, "private AdkPort mbed;" is inside an Activity, which is a class.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top