nms*_*nms 3 android android-intent libgdx
请帮我如何在Libgdx线程中运行以下代码 - 在render(),create()等中......
public class MyGame implements ApplicationListener, InputProcessor {
...
Intent discoverableIntent = new
Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
startActivity(discoverableIntent);
.....
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"http://market.android.com/details?id=" + getPackageName()));
startActivity(marketIntent);
Run Code Online (Sandbox Code Playgroud)
代码有编译错误.我搜索了一些类似的线程,但没有"startActivity"的确切代码示例.谢谢.
P.T*_*.T. 16
LibGDX是一个独立于平台的库,因此使用LibGDX平台netural API的所有代码本身必须是平台无关的(因此没有Android或Windows调用等).要访问特定于平台的功能,标准方法是定义接口,并使用平台无关代码中的接口.然后在应用程序的Android(或桌面)特定项目中创建接口的实现,并在初始化libGDX组件时传递该实现.
本教程有更多详细信息:http://code.google.com/p/libgdx-users/wiki/IntegratingAndroidNativeUiElements3TierProjectSetup
以下是对相同方法的另一种描述(编写得更好,但示例与您的关系并不明确):http://code.google.com/p/libgdx/wiki/ApplicationPlatformSpecific
本教程对访问Android原生UI元素感兴趣,但基本思想与您想要的一致.
另一个教程:https://carlorodriguez.github.io/blog/2014/10/05/android-platform-specific-code-with-libgdx/
| 归档时间: |
|
| 查看次数: |
8667 次 |
| 最近记录: |