如何从活动内部启动壁纸的预览/选择壁纸活动?

时间:2011-04-05 05:52:32

标签: android android-intent preview wallpaper

我认为我的问题相当简单......如何从一个活动(同一个应用程序)中启动预览动态壁纸的标准活动?

*编辑:在Logcat中...这是启动我想要使用的意图的条目...

04-06 09:44:08.369:INFO / ActivityManager(17452):从pid 21944开始:Intent {cmp = com.android.wallpaper.livepicker / .LiveWallpaperPreview(有附加内容)}

2 个答案:

答案 0 :(得分:0)

你是说这样的意思吗?

  1. 制作一个动态壁纸全屏
  2. 的活动
  3. 使用以下方式打开该活动:

    Intent i = new Intent(this,[Activityname]);
    startActivity(ⅰ);

答案 1 :(得分:0)

哈哈哈..这个答案有点晚了。 ;-)但是,我不认为它已被正确回答了所以这就是......我收集到的是你想要启动壁纸选择器。根据哪个Android版本,有两种方法可以做到这一点,您将在下面看到。您只能在版本16之后指定您的壁纸。否则,您启动选择器并且用户指定壁纸。

   if (android.os.Build.VERSION.SDK_INT >= 16)
    {
        Intent intent = new Intent("android.service.wallpaper.CHANGE_LIVE_WALLPAPER");
        intent.putExtra("android.service.wallpaper.extra.LIVE_WALLPAPER_COMPONENT", new ComponentName(getApplicationContext().getPackageName(), (new StringBuilder(String.valueOf(getApplicationContext().getPackageName()))).append(".LiveWallpaper").toString()));


        try
        {
            startActivity(intent);
            finish();
            return;
        }
        catch (ActivityNotFoundException activitynotfoundexception)
        {
            activitynotfoundexception.printStackTrace();
        }
        return;
    }
    Intent intent1 = new Intent();
    intent1.setAction("android.service.wallpaper.LIVE_WALLPAPER_CHOOSER");
    try
    {
        startActivity(intent1);
    }
    catch (ActivityNotFoundException activitynotfoundexception1)
    {
        activitynotfoundexception1.printStackTrace();
        Toast.makeText(getApplicationContext(), "Live Wallpapers not supported", 1).show();
    }
    finish();
相关问题