2

我用谷歌搜索了一些解释,但没有确切的例子我不明白。我想从 Libgdx touchdown() 线程运行以下代码。

       public void goToTheMarket() {
              Intent goToMarket = new Intent(Intent.ACTION_VIEW)
              .setData(Uri.parse("market://details?id=com.myapp"));
       startActivity(goToMarket);
       }

该代码仅在我的“MyActivity 类扩展 AndroidApplication”中没有编译错误。

它在 Libgdx 线程中作为 MyActivity.GoToTheMarket 仅作为静态可见。但我收到错误,无法从非静态运行静态

如果我创建一个类并将其运行为

       GoToTheMarket goToTheMarket=new GoToTheMarket()

然后我得到 looper.prepare 运行时错误。

请编写完整的代码如何运行我的代码。非常感谢!!!

4

2 回答 2

2

您可以参加IntegratingAndroidNativeUiElements3TierProjectSetup

这是帮助集成 android 原生 ui 和 libgdx 的绝佳指南。

于 2012-09-17T09:21:29.423 回答
-1

试试下面的代码。

context.startActivity();

于 2012-09-14T13:31:59.063 回答