English 中文(简体)
安德列斯-连接三星银河Ace VIA 蓝色同Sado T
原标题:Android - Connecting Samsung Galaxy Ace VIA Bluetooth to NXT

因此,我增加了对空洞档案的许可,并粉碎了我的装置,但我在这里正在遇撞: Set pairedDevices = btAdapter.getBondedDevices();

我试图通过点击连接:

private OnClickListener myListener = new OnClickListener() {
    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.main_btnYes:
            connectToNXT(); // connect to NXT
                myIntent = new Intent(v.getContext(), SelectSession.class);
                startActivityForResult(myIntent, 0);
            break;
        case R.id.main_btnNo:
            myIntent = new Intent(v.getContext(), ExitScreen.class);
            startActivityForResult(myIntent, 0);
            break;
        }
    }
};

Here is the connectToNXT() method: The crash occurs here: Set bondedDevices = btAdapter.getBondedDevices(); private void connectToNXT() {

        BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();

        **Set<BluetoothDevice> bondedDevices = btAdapter.getBondedDevices();**

        BluetoothDevice nxtDevice = null;   

}

任何人都知道为什么会造成坠毁?

而且,由于Im在甲状腺和蓝to(2天:D)上很新,有人可能很喜欢,让我知道对甲状蓝to有好的辅导?

感谢

里。

最佳回答

我在尝试了各种法典(其中不曾做过......)之后,设法从这些法典中选取比,让它去做我的钟。

I m 采用三星银河(Rodid OS)智能电话,电线2.2.1

这里使用的是连接方法。 如果你愿意,可以自由使用。

<<>Declarations>:

    // This is the NXT Mac Address. Each device has a specific Mac. Find it in the Build output when uploading
    // your NXT app to the brick using a USB cable. MUST USE USB CABLE TO SEE MAC ADDRESS!
    final String nxtMac = "00:16:53:05:3C:F5";
    //Important: This is the data stream used to communicate with the NXT.
    private DataOutputStream nxtDos = null;
    BluetoothAdapter localAdapter;
    BluetoothSocket nxtSocket;
    boolean success = false;

www.un.org/Depts/DGACM/index_spanish.htm 联接方法

    //Connect to NXT
    public boolean connectToNXT() {         
        // get the BluetoothDevice of the NXT
        BluetoothDevice nxt = localAdapter.getRemoteDevice(nxtMac);
        //Try to connect to the nxt
        try {
            nxtSocket = nxt.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
            nxtSocket.connect();
            //Get the Data stream
            nxtDos = new DataOutputStream(nxtSocket.getOutputStream());
            success = true;
        } catch (IOException e) {
            Log.d("Bluetooth", "Err: Device not found or cannot connect");
            success = false;
        }
        return success;
    }

送我的话,请你寄希望。

Rich.

问题回答

Christophe T s MAC 地址可在日记/日记本上找到。 根据这一选择,身份证号码是MAC地址。 不需要USB!

我的猜测:一门NullPointerException。 你的比喻是无的,你试图从中寻找一种方法,造成努埃切韦托。

But can t you provide a stacktrace or something ? Without a log it s hard to know what hapenned. If you use eclipse, go to Window/Show/Android/Logcat.

你们也可以以欺骗方式提出申请,在贵方的坠毁和看望锅炉是否具有价值之前,就有一个突破点。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签