2
public class ShortCurActivity extends Activity{ 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 

    final Button button = (Button)findViewById(R.id.b_start); 
    if(button != null){ 
    button.setOnClickListener(new View.OnClickListener() { 

     public void onClick(View paramView) { 
      Intent i = new Intent(ShortCurActivity.this, ServiceWallpaper.class); 
        startService(i); 
     } 
    }); 
    } 

} 

나는 활동에서 라이브 벽지 서비스를 시작할 수 있는지 알고 싶습니다. 의도를 사용하려고 시도했지만 작동하지 않습니다. 일부 디자이너는 사용자들이 :(원할 때마다 자신의 라이브 배경 화면을 변경할 수 있도록 나를 라이브 배경 화면에 바로 가기를 만들고 싶어활동에서 라이브 벽지 서비스를 시작하십시오

답변

0

프로그램 사용자의 LWP를 변경할 수있는 방법이있을 것 같지 않습니다.

3
if (Build.VERSION.SDK_INT > 15) 
      { 
       i.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER); 
       String pkg = WallpaperService.class.getPackage().getName(); 
       String cls = WallpaperService.class.getCanonicalName(); 
       i.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(pkg, cls)); 
      } 
      else 
      { 
       i.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER); 
      } 
      startActivityForResult(i, 0);`` 
관련 문제