本文介绍了我如何启动preVIEW /选择壁纸的活动我的壁纸从里面的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的问题是相当简单的...我怎么发起的活动中为$ P $从pviewing我的动态壁纸的标准活动(同一应用程序的)?

I think my question is fairly straight forward... how do I launch the standard activity for previewing my Live Wallpaper from within an Activity (of the same application)?

*编辑:在logcat的......这里是入门当您启动我想使用的意图...

* In Logcat... here is the entry when you launch the intent I want to use...

9月4日至六日:44:08.369:信息/ ActivityManager(17452):启动:{意向CMP = com.android.wallpaper.livepicker / .LiveWallpaper preVIEW(有临时演员)}从PID 21944

04-06 09:44:08.369: INFO/ActivityManager(17452): Starting: Intent { cmp=com.android.wallpaper.livepicker/.LiveWallpaperPreview (has extras) } from pid 21944

推荐答案

哈哈哈..这个答案即将有点晚了。 ;-)不过,我不认为它已经答对尚未所以这里去...我收集哪些是你要启动的壁纸选择器。有两种方法可以做到这一点,这取决于Android版本,你会看到下面。您只能16版本后,指定你的壁纸否则,启动选择器,用户指定的墙纸。

Hahaha.. This answer is coming a little late. ;-) But, I don't think it's been answered correctly yet so here goes... What I gather is that you want to launch the wallpaper chooser. There's two ways to do that depending on which android version, you'll see below. You can only specify YOUR wallpaper after version 16. Otherwise, you launch the chooser and the user specifies the wallpaper.

   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();

这篇关于我如何启动preVIEW /选择壁纸的活动我的壁纸从里面的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:49