title: Setting Home Screen wallpaper programmatically (Changing home screen and lock screen)
body: <p>I have an application that change home screen wallpaper if you click "Set as Wallpaper button" but if you click this button changing home screen and lock screen walpaper.
  I want to change <strong>just</strong> home screen wallpaper</p>
  
  <p>Here is the code</p>
  
  <pre><code> button1.setOnClickListener(new OnClickListener() {
  
                  @Override
                  public void onClick(View v) {
                      WallpaperManager myWallpaperManager
                              = WallpaperManager.getInstance(getApplicationContext());
  
                      try {
  
  
               myWallpaperManager.setResource(+ R.drawable.image_0);
  
                          Toast.makeText(
                                  getBaseContext(),
                                  "Wallpaper has been updated",
                                  Toast.LENGTH_SHORT).show();
  
                      }
                      catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                  }
              });
  </code></pre>