【问题标题】:Intent for opening the watch face picker in Android Wear在 Android Wear 中打开表盘选择器的意图
【发布时间】:2015-03-29 23:07:54
【问题描述】:

作为我正在开发的应用程序的一部分,我想以编程方式打开 Android Wear 手表上的表盘选择器(通常通过长按当前表盘来实现)。请注意,我并没有尝试以编程方式更改表盘,而只是打开选择器以便用户可以选择新的表盘。

我熟悉在 Android 中使用 Intent 启动 Activity,我相信我需要做这样的事情:

Intent intent = new Intent("???");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

我只是不知道用什么来代替“???”在上面的代码中。

【问题讨论】:

    标签: android android-intent wear-os


    【解决方案1】:
    Intent intent = new Intent(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
    startActivity(intent);
    

    WallpaperManager

    【讨论】:

    • 这段代码实际上对我有用。它应该被标记为正确答案。
    【解决方案2】:

    表盘只是专门的壁纸,因此您可以使用所有可用于壁纸的 Android 功能。在这种情况下,您想像这样使用Intent.ACTION_SET_WALLPAPER

    Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER);
    startActivity(Intent.createChooser(intent, "Select Wallpaper"));
    

    【讨论】:

    • 这对我不起作用。它只是说没有支持此功能的应用程序。
    猜你喜欢
    • 2021-08-29
    • 1970-01-01
    • 1970-01-01
    • 2012-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多