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.