Pregunta

I use below code to set photo as wallpaper:

try {
    File f = new File(PhotoPath);
    InputStream in = new FileInputStream(f);
    this.setWallpaper(in);
} catch (IOException e) {
    e.printStackTrace();
}

For some photo, it can set as wallpaper success.
But for some photo, the wallpaper will be set to device default wallpaper or all black.
Is there any limitation of the photo which be set to wallpaper?
Or this code how to modify to fix issue?

¿Fue útil?

Solución

Try this method from this link : developer.

public void setStream (InputStream data);

Currently image must be either a JPEG or PNG. This method supports from API Level 5.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top