小编omn*_*iyo的帖子

Android:getBluetoothService()调用没有BluetoothManagerCallback

我正在尝试将我的Nexus 4与Wii平衡板连接,但我收到此错误:

getBluetoothService() called with no BluetoothManagerCallback
connect(), SocketState: INIT, mPfd: null
Run Code Online (Sandbox Code Playgroud)

所以它没有完成连接.

我的插座:

public final class wSocket
{
    public static BluetoothSocket create(BluetoothDevice dev, int port)
    {
        try {
        /*
         * BluetoothSocket(int type, int fd, boolean auth, boolean encrypt, BluetoothDevice device, int port, ParcelUuid uuid)
         */
            Constructor<BluetoothSocket> construct = BluetoothSocket.class.getDeclaredConstructor(int.class, int.class, boolean.class,
                boolean.class, BluetoothDevice.class, int.class, ParcelUuid.class);

            construct.setAccessible(true);
            return construct.newInstance(3 /* TYPE_L2CAP */, -1, false, false, dev, port, null);
        } catch (Exception ex) {
            return null;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

它给我的错误:

private …
Run Code Online (Sandbox Code Playgroud)

sockets android bluetooth

7
推荐指数
1
解决办法
2万
查看次数

设置 Visual Studio 库项目依赖项

鉴于以下情况,我正在努力寻找在 Visual Studio(即 2015)中设置依赖项的正确方法:

我有2个项目:

  • 引擎:它是一个静态库项目,依赖于我在“Librarian”、“其他依赖项”部分中指定的 glfw、glew 和 opengl .lib 文件。我还正确添加了 include 和 libs 目录。
  • 游戏:它应该只能访问 Engine 项目提供的 API,因此我将 Engine headers 目录添加到 Game include 目录中,并且对于生成的 Engine.lib 和附加库目录也是如此。

至此,Engine项目编译成功。

我希望 Game 项目也能工作,但是当我尝试使用简单的 main.cpp 编译该项目时,编译器显示此错误(引用 Engine 项目中的文件):

-- 错误 C1083 无法打开包含文件:'GL/glew.h':没有这样的文件或目录

我不想包含 opengl、glew 和 glfw 库,也不想包含目录到我的游戏项目中,因为用户不应该访问此 API。

那么......实现这一目标的正确方法是什么(越简单越好)?

提前致谢

c++ opengl glew static-libraries visual-studio

5
推荐指数
1
解决办法
5586
查看次数

Lisp中的嵌套结构

我从Lisp开始,我需要知道是否可以使用嵌套结构.这是我的尝试:

(defstruct casilla i j)
(defstruct tablero caballo reina t1 t2)

(defparameter *estado-inicial*
  (make-tablero :caballo (make-casilla :i 1 :j 1)
                :reina   (make-casilla :i 5 :j 4)
                :t1      (make-casilla :i 3 :j 5)
                :t2      (make-casilla :i 4 :j 5)))
Run Code Online (Sandbox Code Playgroud)

如果我必须访问该字段i:

(defun es-estado-final (estado)
  (and (= (caballo-casilla-i estado) 3)
       (= (caballo-casilla-j estado) 1)))
Run Code Online (Sandbox Code Playgroud)

是对的吗?似乎不是因为caballo-casilla-i未定义.提前致谢.

lisp struct field nested common-lisp

3
推荐指数
1
解决办法
301
查看次数

在Android中加载文件夹中的所有图像

我想在不知道文件名的情况下将所有图像加载到文件夹中,并将它们存储到整数向量中 - 在运行时.

事实上,我需要像在这个例子中所做的那样:http: //developer.android.com/resources/tutorials/views/hello-gridview.html 但是在运行时并且不知道文件的名称.

有帮助吗?


在你的答案之后我知道该怎么做...但我不知道如何以与例子相同的方式继续下去:

我怎么能将图像保持在整数数组而不是可绘制的数组或类似?这是我对drawable的尝试:DrawArray [i] = Drawable.createFromPath(fileArray [i] .getPath()); 但我想用整数来完成它以适应上面的链接!

提前致谢


一般解决方案: http ://www.anddev.org/viewtopic.php?t = 575

java android gridview

2
推荐指数
2
解决办法
1万
查看次数