2011-04-05 32 views
0

我認爲我的問題是相當直接的...我如何啓動預覽我的動態壁紙從一個活動(同一應用程序)的標準活動?如何從活動內啓動我的Wallpaper的預覽/選擇壁紙活動?

*編輯:在logcat的......這裏是當您啓動我想使用的意圖...項

9月4日至6日:44:08.369:信息/ ActivityManager(17452):首發:意圖{cmp = com.android.wallpaper.livepicker/.LiveWallpaperPreview(has extras)}來自pid 21944

回答

0

你的意思是這樣的嗎?

  1. 請其保持動態壁紙全屏
  2. 打開該活動使用的活性:

    意圖I =新意圖(此,[Activityname]);
    startActivity(i);

+0

不是真的......在android中有一個預覽動態壁紙的默認Activity。我想利用該Activity/Intent在設備上使用通用Live Wallpaper預覽活動。我假設你需要通過意圖(不管它叫什麼)一些關於你想要預覽的動態壁紙的額外信息。 – CatalystNZ 2011-04-05 21:45:39

+0

更多類似這樣:http://stackoverflow.com/questions/2749791/creating-own-livewallpaperpreview? – 2011-04-06 05:30:56

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