Set<BluetoothDevice> mDevices;
public void selectDevice(){
mDevices = mBA.getBondedDevices();
final int mPairedDeviceCount = mDevices.size();
if(mPairedDeviceCount == 0){
Toast.makeText(MainActivity.this, "페어링할 디바이스가 없습니다", Toast.LENGTH_SHORT).show();
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("블루투스 장치 선택");
List<String> listItems = new ArrayList<String>();
for(BluetoothDevice device : mDevices) {
listItems.add(device:mDevices){
}
listItems.add("취소");
}
final CharSequence[] items = listItems.toArray(new CharSequence[listItems.size()]);
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if (item == mPairedDeviceCount) {
} else {
}
}
});
아두이노와 연계되는 프로젝트를 진행중입니다. 안드로이드에서 블루투스 API를 사용하여 아두이노와 연동을 시킬려고 하고, 목록을 보여줄려고 합니다. 헌데 저 빨간색 저 코드에서 에러가 나네요. device옆에 : 부분과 괄호 끝나는부분에 에러가 나네요
에러 : ')' expected, ';' expected, unexpected token
이런 오류가 나네요. 어떻게 해야할까요
http://hyoin1223.tistory.com/entry/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-%EB%B8%94%EB%A3%A8%ED%88%AC%EC%8A%A4-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D 이사이트에서 참고를 했습니다