1
我正在學習Android上使用Wrox 專業Android 2應用程序開發書的藍牙編程。發現監控器示例(第432)有這樣的代碼片段:Android:監測藍牙發現 - 這個編譯錯誤是什麼意思?
BroadcastReceiver discoveryMonitor = new BroadcastReceiver() {
String dStarted = BluetoothAdapter.ACTION_DISCOVERY_STARTED;
String dFinished = BluetoothAdapter.ACTION_DISCOVERY_FINISHED;
@Override
public void onReceive(Context context, Intent intent) {
if (dStarted.equals(intent.getAction())) {
// Discovery has started.
Toast.makeText(getApplicationContext(),
"Discovery Started...", Toast.LENGTH_SHORT).show();
}
else if (dFinished.equals(intent.getAction())) {
// Discovery has completed.
Toast.makeText(getApplicationContext(),
"Discovery Completed...", Toast.LENGTH_SHORT).show();
}
}
};
registerReceiver(discoveryMonitor,
new IntentFilter(dStarted));
registerReceiver(discoveryMonitor,
new IntentFilter(dFinished));
...並在每個兩個最後我得到registerReceiver調用的。 。 。
上標記語法錯誤,AnnotationName有望代替
語法錯誤,插入「類型VariableDeclaratorId」完成FormalParameterList
什麼是annotationName和什麼錯嗎?
在此先感謝!